简体   繁体   English

Facebook访问令牌随离线访问而过期

[英]Facebook Access Token Expiring with offline access

I have an application to manage a users Facebook notifications, the app requests offline_access as well as manage notifications permissions. 我有一个用于管理用户Facebook通知的应用程序,该应用程序请求offline_access以及管理通知权限。 My logs have been filling up with Facebook errors, I understand that the change password error is going to happen, but what I don't understand is why I am getting these errors: 我的日志中充斥着Facebook错误,我知道更改密码错误将要发生,但是我不明白的是为什么我会收到这些错误:

Facebook Error: Error validating access token: Session has expired at unix time 1320012000. The current unix time is 1320191317. Facebook Error: (#200) The "manage_notifications" permission is required in order to query the user's notifications. Facebook错误:验证访问令牌时出错:会话已在unix时间1320012000到期。当前的unix时间为1320191317。Facebook错误:(#200)需要“ manage_notifications”权限才能查询用户的通知。

They are occurring way too often to be users just rejecting the permissions and the access tokens that are expiring have expirations of 0 他们正在发生的方式往往是用户只需拒绝权限和即将到期的有0到期的访问令牌

For future reference, offline_access has been removed, now it is possible to get an access_token with a life span of 2 months 为了将来参考,已经删除了offline_access,现在可以获取一个寿命为2个月的access_token

https://developers.facebook.com/roadmap/offline-access-removal/ https://developers.facebook.com/roadmap/offline-access-removal/

Are trying to use the user's token? 正在尝试使用用户的令牌吗? Once you request offline access, you should "login" with your app to get it's own access token when you want to do something, not use the user's token that you saved. 一旦请求离线访问,您就应该在应用程序中“登录”以获取自己的访问令牌,以进行某些操作,而不要使用您保存的用户令牌。 If that is what you are doing. 如果那是你在做什么。

Scroll down to the part on this page labeled "App Login". 向下滚动到此页面上标记为“应用程序登录”的部分。 That's how you are supposed to do things when user's are not present, not retain and use the user's token. 这就是当用户不存在,不保留和使用用户令牌时应该采取的措施。

https://developers.facebook.com/docs/authentication/ https://developers.facebook.com/docs/authentication/

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

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