I just made a website where i'm authorizing the users using the oauth2.0 and graph api. I also want to logout the user from my website and facebook when they click on the logout button. I'm unable to find a solution for this last 24 hours.My code is in asp.net. Thanks in Advance
If you're redirecting the user to a login page you should put the redirect within the callback function that can be passed to FB.logout as a parameter, like this:
<a href="#" onclick="mysignout(url);">logout</a>
function mysignout(url)
{
FB.logout(function()
{
top.location.href = 'url'
});
}
FB.logout appears to make an ajax call to revoke authentication on the server and can take several seconds to complete successfully. If you redirect within the anchor link then FB.logout will not have completed successfully before the redirect in some browsers. In particular, this will happen with IE.
See this post: FB.logout not working in IE8
<a href="#" onclick="FB.logout();">logout</a>
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