开发者

User logs out on Facebook, JS SDK stops working

开发者 https://www.devze.com 2023-04-12 00:11 出处:网络
I know there are similar questions to this around but none seem to quite address the issue I\'m having or are referring to the older non-OAuth versions of the SDKs.

I know there are similar questions to this around but none seem to quite address the issue I'm having or are referring to the older non-OAuth versions of the SDKs.

I am using both the JS and PHP SDK's as provided by Facebook. Authentication is done using JS with that then setting a cookie that allows the PHP SDK to authenticate, as recommended by Facebook.

This works fairly well until a user logs out of Facebook on their site (i.e. they do not use the FB.logout method on my site). None of the auth.statusChange, auth.authResponseChange or auth.logout methodes are fired either immediately or on the next pageload. However, I can see that cookies are being changed even as I click around the Facebook site (but not the fbsr_xxxxxxxxxx one for the signed request).

My difficulty is that, come the next page load, I have no idea that the user logged out of Facebook. Because I still have the 'fbsr_xxxxxxxxxx' cookie with an access token, I can continue to make API calls through the PHP SDK but the JS SDK becomes totally unresponsive. Methods either complain about not having an access token or fail to run their callback functions entire开发者_开发知识库ly.

Am I missing something totally obvious here? I am utterly perplexed so any help really would be most welcome.

FuzzyDunlop


You need to have a non expiring token, which you can get using the offline access permission, so that you can acces user details from your application even when user logs out of facebook, and that too works until the user doesnt changes his password, if he do so, you again have to request for a new token.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号