Tuesday, April 3, 2012

Facebook C# SDK and logout on Windows Phone

(Facebook C# SDK version: 5.4.1.0)

Most tutorials explain how to connect to Facebook for a Windows Phone application... But the logout is rarely mentioned while it is a very important feature for the users of your application.

So, how can you propose the possibility of logout to your users? We suppose that you already have a WebBrowser used for the login: we will call it "FacebookWebBrowser".

To make a logout from this WebBrowser, you just have to do that:

   1:  FacebookWebBrowser.Navigate(new Uri(String.Format("https://www.facebook.com/logout.php?next={0}&access_token={1}", _loginUrl, _accessToken)));

The _loginUrl comes from the "GetLoginUrl" method (from the Facebook C# SDK) and the _accessToken comes from a previous login on Facebook.

Nothing complicated but very useful to know!

1 comment:

  1. Truly said 'Nothing complicated but very useful to know!'... Thanks it helped me....

    ReplyDelete

Note: Only a member of this blog may post a comment.