Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
21
rated 0 times [  25] [ 4]  / answers: 1 / hits: 30621  / 11 Years ago, thu, november 7, 2013, 12:00:00

Totally lost on this and docs don't really give any insight on this...



Using the Facebook Javascript SDK in my app with this login button code:



<fb:login-button scope=manage_pages,read_insights,ads_management autologoutlink=true size=large></fb:login-button>


As per the docs, autologoutlink=true param turns the login button to log out once the user is logged in. I want to keep this functionality and not write my own button code



This event calls FB.logout but still returns the error message in the callback



FB.Event.subscribe('auth.logout', function(response) {                                              
FB.logout(function(response) {
// FB.logout() called without an access token.
});
});


I would like to use the Facebook Login Widget and not my own button for login, so the other answers on the same subject don't help. I don't understand how I'm supposed to pass the access_token to prove I'm authorized to logout...


More From » facebook

 Answers
14

Apparently this isn't possible, at least in no way I can figure out. Quick solution is call this function from a custom Log Out button:



function fbLogoutUser() {
FB.getLoginStatus(function(response) {
if (response && response.status === 'connected') {
FB.logout(function(response) {
document.location.reload();
});
}
});
}


The page reload makes another request to Facebook which then sees the unauthorized state and removes the cookie from the browser which in turn invalidates the access_token. So this logs out the user from the site and from Facebook.


[#74429] Wednesday, November 6, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
juancarlos

Total Points: 580
Total Questions: 105
Total Answers: 103

Location: Grenada
Member since Sun, Dec 20, 2020
3 Years ago
;