我使用的是Facebook Javascript SDK。对于我的应用程序,我可以让用户使用Facebook,Twitter或帐户(电子邮件/密码)登录。我可以让Facebook身份验证工作。在Facebook认证成功后,我创建了一个用户会话,用户继续使用该应用程序。我在应用程序中有一个注销按钮,可以销毁会话并将用户发回登录页面。Facebook的getLoginStatus返回功能不刷新页面刷新
当用户重新登录登录页面时,他们仍然连接到Facebook。我试过调用FB.logout,但getLoginStatus的返回函数从不会触发。我究竟做错了什么?
这里是我的代码:
window.fbAsyncInit = function()
{
FB.init({appId: 99999999, status: true, cookie: true, xfbml: true, oauth: true});
//LOGOUT FB USER
FB.getLoginStatus(function(response)
{
alert("status: " + response.status);
if (response.authResponse)
{
FB.logout();
alert('logged out');
}
}, true);
//SUBSCRIBE TO LOGIN EVENT
FB.Event.subscribe('auth.login', function(response)
{
if(response.authResponse)
{
FB.api('/me', function(response)
{
//at this point user has been authenticated so they can continue with app...
});
}
else
{
alert("Ooops, the Facebook authentication has failed. Please try again.");
}
});
};
(function(d){
var js, id = 'facebook-jssdk';
if (d.getElementById(id)){ return; }
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementById('fb-root').appendChild(js);
}(document));
什么是各地结合Facebook验证到您的应用程序的最佳实践?如何将日志记录用户从应用程序中移出而不将其全部从Facebook中注销?
谢谢你的时间。