Facebook访问令牌与消息“会话不匹配当前存储的会话”无效 [英] Facebook access token invalid with message "session does not match current stored session"?
问题描述
我最近开始收到这个错误,发布到Facebook newsfeed流
的一个应用程序用户,
我有访问令牌的离线访问权限,他们以前工作
。
这个错误来自30-40%的用户。
I have recently started getting this error while posting to facebook newsfeed stream of an app user, I do have an offline access permission for the access tokens, and they worked fine previously. This error is coming for 30-40% of the users.
"Error validating access token: Session does not match current stored session.
This may be because the user changed the password since the time the session
was created or may be due to a system error."
推荐答案
您的访问令牌可能无效各种原因(到期时间通过,用户更改密码,用户deauthorized您的应用程序,用户注销Facebook等)。您应该总是设计以解决这种情况。
It's possible for your access token to become invalid for a variety of reasons (expiry time passed, user changed password, user deauthorized your app, user logged out of Facebook, etc.). You should always design to account for this scenario.
如果您的用户处于活动状态,则很容易得到一个来自OAuth端点的新的访问令牌,而不必做任何事情。如果没有,您应该制定一个计划(如发送电子邮件),以便如何让他们返回,以便您可以获得新的访问令牌。您描述的场景不一定是不寻常的。您可以在这里找到一些代码示例有关如何处理过期的访问令牌的帮助。
If your users are active, it's easy to get a new access token from the OAuth endpoint without them having to do/see anything. If not, you should make a plan (such as emailing them) for how you will get them to return so you can get a new access token. The scenario you're describing is not necessarily unusual. You can find some code samples here for help on how to handle expired access tokens.
这篇关于Facebook访问令牌与消息“会话不匹配当前存储的会话”无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!