Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging out of Facebook C# SDK on WP7

I am trying to add a feature for logging out, which is called in the click event of a ApplicationBarMenuItem, following the instructions on this blog

This is what my code looks like:

    var oauth = new FacebookOAuthClient();

    var logoutParameters = new Dictionary<string, object>
          {
              { "next", "http://www.facebook.com" }
          };

    var logoutUrl = oauth.GetLogoutUrl(logoutParameters);

    LayoutRoot.Children.Add(FacebookLoginBrowser);
    FacebookLoginBrowser.Navigate(new Uri(logoutUrl.AbsoluteUri, UriKind.Absolute));

What I expected this code would do is log the user out of Facebook when the Navigated event completes and then displays whatever URL is passed in the parameter (in this case facebook.com). However, what I'm seeing is that it always loads "http://m.facebook.com/" regardless of what is passed in and it does not logout of Facebook. I don't care what it loads after (that would be great, but at this point I just want it to do the logout action so the user can quit and login when they launch my app again). The only way I can successfully logout a user is if they understand when the page loads that they need to scroll down, zoom in, and click "logout" manually at the bottom of the page - which just isn't an acceptable user experience.

I also downloaded the sample code from that blog and it does roughly the same.

I've seen this and this post and the URL used is pretty close to what is returned by oath.GetLogoutUrl(logoutParameters), but I tried constructing the exact URL with the same result:

var logoutUrl = new Uri("https://www.facebook.com/logout.php?next=http://www.facebook.com&access_token="+fbClient.AccessToken);

This is definitely a ship stopper for my app, so any help or suggestions anyone can provide would be much appreciated!

like image 242
Subcreation Avatar asked Jun 05 '11 01:06

Subcreation


1 Answers

Apparently it's broken on Facebooks side: http://bugs.developers.facebook.net/show_bug.cgi?id=17217

like image 97
Daniel Clark Avatar answered Oct 12 '22 19:10

Daniel Clark