Logout

The method FB.logout() logs the user out of your site and, in some cases, Facebook.

Consider the 3 scenarios below:

  1. A person logs into Facebook, then logs into your app. Upon logging out from your app, the person is still logged into Facebook.
  2. A person logs into your app and into Facebook as part of your app's login flow. Upon logging out from your app, the user is also logged out of Facebook.
  3. A person logs into another app and into Facebook as part of the other app's login flow, then logs into your app. Upon logging out from either app, the user is logged out of Facebook.

Example

FB.logout(function(response) {
  // user is now logged out
});

Best Practices

FB.logout will log the user out of your site and, in some cases, Facebook (see the cases above). You will need to have a valid access token for the user in order to call the function.

Calling FB.logout will also invalidate the access token that you have for the user, unless you have extended the access token.

Parameters

Name Type Required Description

cb

Function

yes

The callback function.