第一次获取 Facebook 访问令牌的到期时间是多少
几天前,我尝试刷新访问令牌,观察到“Web”类型的应用程序的初始访问令牌到期时间约为 2 小时,而“本机/桌面”类型的应用程序的初始访问令牌到期时间为 25 小时。 但从今天早上开始,我发现对于本机/桌面类型应用程序,初始访问令牌到期时间为 60 天。 所以我想知道 Facebook 中是否有关于应用程序初始到期时间的记录?
Few days back I was trying to refresh access token and observed for "Web" type of app the initial access token expiry time is around 2 hrs and for "native/desktop" type app its 25 hrs.
But since today morning I am seeing that for native/desktop type app the initial access token expiry time is 60 days.
So I was wondering if it is documented somewhere about the initial expiry time of an app in Facebook ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这篇博文 表示默认为两小时,但也可以是 刷新为额外 60 天
This blog post says that two hours is the default, but it can be refreshed for an additional 60 days
是的,这是我们关于该主题的当前官方文档:
https://developers.facebook .com/docs/offline-access-deprecation/
Yes, here's the current official documentation we have on the subject:
https://developers.facebook.com/docs/offline-access-deprecation/
我认为没有任何官方文档解释如何计算到期时间。但是,当 access_token 传递到您的应用程序时,您还应该收到一个“expires”参数。
expires 参数是令牌需要重新验证之前的秒数。在对应用程序进行编码时,请确保记录下来并提示用户在其个人资料过期时重新链接。
一些注意事项:
您可以请求“offline_access”权限无限期到期。
如果用户更改密码或从其隐私/安全设置取消对您的应用程序的授权,则令牌将自动失效。
I don't think there is any official documentation that explains how the expiry time is calculated. However, when the access_token is passed to your application, you should also receive an "expires" parameter.
The expires parameter is the number of seconds until the token needs to be revalidated. When coding your app, make sure to record this and prompt the user to relink their profile when it expires.
Some notes:
You can request "offline_access" permission for infinite expiry time.
The token will automatically become invalidated if the user changes their password or deauthorizes your application from their privacy/security settings.
应用程序高级设置中有一个新选项:弃用offline_access
如果启用,应用程序将获得长期访问令牌,但您不能要求offline_access。我相信弃用过程完成后,到期时间将恢复正常,或者他们可能会将其保留为 60 天。
There is a new option in App Advanced Settings: deprecate offline_access
If enabled the app will be issued long lived access token but you can't ask for offline_access. I believe after deprecation process is completed the expiry time will return to normals or they might leave it to 60 days.