Question

I am using facebook SDK for .NET to integrate facebook to windows phone application. the facebook log in screen appears when I try to log in for the first time. Then if i sign out and sign in again the same user gets signed in.

My code is as follows: for login

session = await App.FacebookSessionClient.LoginAsync("user_about_me,read_stream");

for logout

App.FacebookSessionClient.Logout();

How to log in as different user?

Was it helpful?

Solution

I think the implementation of FacebookSessionClient.Logout() is not complete for now. Here is the code can do the trick for you:

    private void m_buttonLogout_Click(object sender, RoutedEventArgs e)
    {
        var fb = new FacebookClient();
        var logoutUrl = fb.GetLogoutUrl(new {
            next = "https://m.facebook.com/connect/login_success.html",
            access_token = App.FacebookSessionClient.CurrentSession.AccessToken;
        });

        var webBrowser = new WebBrowser();
        webBrowser.Navigated += (o, args) =>
       {
         if (args.Uri.AbsoluteUri == "https://m.facebook.com/connect/login_success.html")
            {
            App.FacebookSessionClient.Logout();

            NavigationService.GoBack();
            }
        };

        webBrowser.Navigate(logoutUrl);
    }//private void m_buttonLogout_Click(object sender, RoutedEventArgs e)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top