Question

For some reason when I call FB.logout();, the user does not actually get logged out of Facebook.

Why might this be? No js errors get thrown, and I can step through the code as it runs through the SDK... it just doesn't successfully log out.

Was it helpful?

Solution

You need to have the fb-root DIV tag first, then call FB.init() and then FB.logout()

Example Usage:

FB.logout(function(){
  window.location = 'path/url here';
});

Alternatively, you should redirect to this url logout:

www.facebook.com/logout.php?app_key=KEY&session_key=SESSION&next=REDIRECT_URL

OTHER TIPS

You need to have a valid access token when you call FB.logout. Don't remove the fbs_* cookies on your own. FB.logout will do this itself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top