did Facebook change something in javascript sdk authetication today? I used FB Javascript SDK Authetication written by Mahmud Ahsan, and everything was fine, before today. Now it has problems with FB.logout(). Try to LOG IN his demo and than click LOGOUT button. And try to push this button again to login. It will not response. Firebug says: FB.logout() called without an access token. Maybe someone know how to add access token to FB.logout method or.. have a link to documentation about this changes?
My authetication:
window.fbAsyncInit = function() {
FB.init({ appId: '*************',
status: true,
cookie: true,
channelUrl: '//localhost/website/channel.html', // Channel File
xfbml: true,
oauth: true});
// run once with current status and whenever the status changes
FB.getLoginStatus(updateButton);
FB.Event.subscribe('auth.statusChange', updateButton);
};
var button,userInfo;
function updateButton(response) {
button = document.getElementById('fb-auth');
userInfo = document.getElementById('userInfo');
if (response.authResponse){
FB.api('/me', function(info) {
login(response, info); //function will just change text on the button..
});
button.onclick = function() {
FB.logout(function(response) { //here we are, FB.logout method =\
logout(response); //function will just change text on the button..
});
};
} else {
button.innerHTML = 'Login';
button.onclick = function() {
showLoader(true);
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me', function(info) {
login(response, info);
});
} else {
//user cancelled login or did not grant authorization
alert('you are not logged in to facebook or have not granted this app basic permissins. please log in and grand basic permissins to user this application');
}
}, {scope:'email,user_birthday,user_about_me'});
}
}
}
solved! the problem was with FB.event.subscribe. I’m just changed auth.statusChange to another listener – auth.authResponseChange