0

In my app users can register/login using OAuth2 via Facebook and Google. When a user logs out, I also give them the option to logout of their OAuth provider (e.g. in case they're on a public computer).

In the case of Google I do this with the following JavaScript

var img = new Image();
img.src = 'https://accounts.google.com/Logout';

Is there an equivalent solution for Facebook? I've seen this suggestion, but ideally I'm looking for a client-side solution which does not require knowledge of the access token (which I keep on the server-side).

I'd also prefer not to have to include the Facebook SDK if possible.

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • The JS SDK has the [`FB.logout`](https://developers.facebook.com/docs/reference/javascript/FB.logout/) method. (That of course requires an access token as well, but when you embed the SDK into your page and the user has authenticated your app, then it should have one automatically.) – CBroe Apr 10 '15 at 13:15
  • You can see how to use the `FB.logout` method [here](https://developers.facebook.com/docs/reference/javascript/FB.logout/) but as @CBroe mentioned you will need a user access token to use this method. There is no other way to log a person out of Facebook. – The1Fitz Apr 13 '15 at 15:41

0 Answers0