我正在使用 Facebook JS SDK 让用户将他们的 Facebook 帐户连接到我的网站,但我遇到了一个奇怪的问题。
当您按照以下步骤操作时:
- connect for the first time with your fb account,
- authorize my app,
- go in another tab in your browser to the facebook website,
- remove my app,
- go back to my website tab in your browser
- click the connect button again
FB.getLoginStatus 仍将 response.status 返回为“已连接”,直到您刷新我网站的选项卡,然后才会将 response.status 显示为“未授权”。
甚至 FB.login 也会将 response.status 返回为“已连接”,直到我刷新窗口(即使我在此之前调用 FB.logout)
为什么我需要刷新窗 Eloquent 能显示“not_authorized”以及如何解决此问题?
编辑:我正在使用 OAuth 功能
最佳答案
这是因为“FB.getLoginStatus”响应对象由 SDK 缓存。
如果你想解决这个问题,只需调用FB.getLoginStatus并将第二个参数设置为true即可。
FB.getLoginStatus(function(response) {
// this will be called when the roundtrip to Facebook has completed
}, true);
https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/
关于javascript - facebook js sdk 取消授权应用程序仍然导致 FB.getLoginStatus 中连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17923300/