3
每当我尝试从使用Facebook JavaScript SDK进行身份验证的我的网站上“断开”用户时,它反而会彻底摧毁用户的Facebook会话(例如,如果他们在单独的选项卡上登录到Facebook,则会询问他们再次登录)。我有以下客户端代码:如何在不将用户完全登录Facebook的情况下撤消应用程序授权?
$('#logout').bind('click', function(){
if(FB.getSession() !== undefined){
//FB.logout();
// instead of logging out of facebook, just disconnect them
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);
}());
假设jQuery在页面上。 FB.api调用成功,但似乎比它应该“更强大”。它基本上与调用FB.logout()具有相同的效果。
我做错了什么,或者我应该提交一个错误?
谢谢!