Implementing Logout using Facebook C# SDK

Nothing, much to say basically.This post is the result of my frustration about how little has been said about log out using the Facebook C# SDK.

The best way is to have the login and the log out implemented using the same webview. Atleast that is what I did.Another thing that I noticed is unless you closed the webview, it wouldn’t log out. So for my windows 8 store app,I immediately closed the app after logging out.Hope this works for you.


Here is the code.

 var oauth = new Facebook.FacebookClient(Constants.accessToken);
            var logoutParameters = new Dictionary<string, object>
                      {"access_token", Constants.accessToken},
                      { "next", "" }

            var logoutUrl = oauth.GetLogoutUrl(logoutParameters);
            return new Uri(logoutUrl.AbsoluteUri);

Navigate to the uri and in the onloadcompleted event,close or dispose the webview.Your user will be logged out


One response to “Implementing Logout using Facebook C# SDK

  1. I feel that is among the most vital info for me. And i am
    glad reading your article. However should observation on few basic issues, The web
    site style is ideal, the articles is truly great : D.
    Excellent task, cheers

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s