我正在使用Graph API来为Facebook页面选择“fan of the week”,并自动将它们发布到其供稿。OAuth令牌停止工作时该怎么办?
为了宣传订阅源上的粉丝,我为安装该应用的用户存储了OAuth访问令牌。但是有时令牌会失效,然后应用程序将无法发布到Feed。
{
"error" : {
"message" : "Error validating access token: The session has been invalidated
because the user has changed the password.",
"type" : "OAuthException"
}
}
这是错误的另一种类型我也得到有时:
{
"error": {
"message": "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 Facebook has changed
the session for security reasons.",
"type": "OAuthException"
}
}
我已经有这些用户的“offline_access”,但令牌仍然成为无效有时。除了向用户发送电子邮件,要求他们再次访问应用程序页面,以便我可以获得新的OAuth令牌之外,还有什么可以阻止这种情况发生?
谢谢,我试图张贴到页面饲料,但我会尝试这一点。 – Bemmu
我已经授权我的应用程序发布到页面126169047465269.但是,如果我尝试执行curl -d“access_token = appid | appsecret&message = foo”“https://graph.facebook.com/126169047465269/feed”,我得到OAuthException “用户尚未授权应用程序执行此操作” – Bemmu
这适用于用户授权publish_stream(而非offline_access)并且令牌在一小时后过期的情况。我认为这可能值得一试。听起来像你需要用户回到你的应用程序来刷新令牌不幸的。 – bkaid