Ejemplo n.º 1
0
        void LoginFB()
        {
            var client_id = 2383026203;
            var redirect_uri = "https://www.facebook.com/connect/login_success.html";
            var scope = "email,friends_about_me,friends_activities,friends_birthday,friends_checkins,friends_education_history,friends_events,friends_groups,friends_hometown,friends_interests,friends_likes,friends_location,friends_notes,friends_photos,friends_questions,friends_relationships,friends_relationship_details,friends_religion_politics,friends_status,friends_subscriptions,friends_videos,friends_website,friends_work_history,read_stream,friends_online_presence,rsvp_event";
            var login_url = string.Format(
                "https://www.facebook.com/dialog/oauth?response_type=token&display=popup&client_id={0}&redirect_uri={1}&scope={2}",
                client_id, redirect_uri, scope);
            var w = new BrowserWindow { Width=600, Height=500 };
            w.web1.Navigate(login_url);
            w.Show();

            w.web1.Navigated += (s, e) =>
            {
                if (e.Uri.PathAndQuery == "/connect/login_success.html")
                {
                    var str = e.Uri.Fragment;
                    var dict = str.TrimStart('#').Split('&').Select(x => x.Split('=')).ToDictionary(x => x[0], x => x[1]);
                    FBSearchVM.AccessToken = _AccessToken = dict["access_token"];
                    
                    w.Close();
                }
            };
        }