Whenever I try to “disconnect” a user from my website using the JavaScript SDK for authentication, it completely destroys the Facebook user session (if they were registered on Facebook on a separate tab, for example, they will be asked to log in again ) I have the following client side code:
$('#logout').bind('click', function(){
if(FB.getSession() !== undefined){
FB.api({
method: 'Auth.revokeAuthorization'
}, function(response){
console.log('auth revoke', response);
});
}
});
window.fbAsyncInit = function() {
FB.init({
appId: MYAPPIDHERE
,status: true
,cookie: true
,xfbml: true
});
FB.Event.subscribe('auth.sessionChange', function(response){
console.log(response);
location = location.href;
});
};
(function() {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
Suppose jQuery is on a page. The FB.api call is successful, but seems to be “more powerful" than it should be. It basically has the same effect as calling FB.logout ().
What am I doing wrong, or should I indicate an error instead?
Thank!
source
share