I'm logged in to my app using my FB credentials. In the end I do a logout and remove my session variables. I'm logged out from application, but the FB session remains open although I do a post to the FB logout page with the post like in the code:
if (Session["FBAccessToken"] != null){
var fb = new Facebook.FacebookClient();
string accessToken = Session["FBAccessToken"] as string;
//var logoutUrl = fb.GetLogoutUrl(new { access_token = accessToken, next = "https://www.facebook.com/", });
var logoutUrl = fb.GetLogoutUrl(new { next = "https://www.facebook.com/", });
fb.Post(logoutUrl.AbsoluteUri, new { access_token = accessToken });
Session.RemoveAll();
}
I've tried both: logoutUrl generated with and without access token parameter, neither worked for me.
There has been changes on facebook logout since my last blog post. Here is the way to logout.
var fb = new FacebookClient();
var logoutUrl = fb.GetLogoutUrl(new {access_token = "...", next = "...." });
// redirect to logoutUrl.AbsoluteUri
next url cannot be any arbitrary url. I has to be the one that is part of the site url which you used to retrieve the access token.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With