简体   繁体   English

FB.logout()不注销Facebook用户

[英]FB.logout() does not logout facebook user

I have implemented Login with Facebook successfully and now trying to implement logout option. 我已经成功实现了使用Facebook登录,现在尝试实现注销选项。

Included script https://connect.facebook.net/en_US/all.js 包含的脚本https://connect.facebook.net/en_US/all.js

Invoked JavaScript FB.logout(); 调用了JavaScript FB.logout(); as per https://developers.facebook.com/ 按照https://developers.facebook.com/

But I see Facebook session still active and user is not requested for Facebook userid and password on hitting "Login with Facebook" or on Facebook website. 但是我看到Facebook会话仍然处于活动状态,并且在单击“使用Facebook登录”或在Facebook网站上时,未要求用户提供Facebook用户名和密码。

How to test FB.logout() is working or not. 如何测试FB.logout()是否有效。 From the above behavior FB.logout() is not working. 由于上述行为, FB.logout()无法正常工作。

There is a bug in Facebook's javascript-sdk [ Bug Link ] Facebook的javascript-sdk中有一个错误[ Bug Link ]

It explains that if your have checked the Block third-party cookies and site data , the sdk will not be able to log the user out since the cookies remain in your browser. 它说明,如果您已选中“ Block third-party cookies and site data ,则由于Cookie保留在您的浏览器中,因此sdk将无法注销用户。 It says, 它说,

When you call FB.logout we check that Facebook cookies are set for Facebook.com and delete them if they are. 当您调用FB.logout时,我们检查是否为Facebook.com设置了Facebook cookie,如果已设置,则将其删除。 However, when third-party cookies are disabled we're not able to check that the cookies exist and we can't delete them. 但是,禁用了第三方Cookie后,我们将无法检查Cookie是否存在,也无法删除它们。

So as a workaround you can use the below code, 因此,您可以使用以下代码作为变通方法,

FB.logout(function(response) {
  FB.Auth.setAuthResponse(null, 'unknown');
  ...
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM