存储在 cookie 中的 facebook javascript sdk 访问令牌的有效性是什么
如果我使用 facebook javascript 和 xfbml 让用户登录我的应用程序并授予我离线权限。
然后,我可以在服务器上
- 读取 facebook 设置的 cookie,
- 获取访问令牌
- ,将其存储在数据库中
- 并随着时间的推移使用它
,还是该访问令牌仅在活动会话期间有效“即使我已请求并获得了用户权限离线使用”
If I use the facebook javascript and xfbml to get a user to login to my app and grant me offline permissions.
Can I then at the server
- read the cookie set by facebook,
- get the access token
- store it in a db
- and use it over time
or is this access token valid only during the active session "even though I've requested and obtained user permission for offline use"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,如果您向用户请求“offline_access”,您可以执行您所说的所有操作并无限期地使用访问令牌。如果您不请求离线访问,访问令牌将在几个小时后过期。访问令牌过期的唯一原因是用户删除您的应用程序或从您的应用程序中删除离线访问权限。
Yes, you can do everything you stated and user the access token indefinitely if you request "offline_access" from the user. If you don't request offline_access the access token expires after a few hours. The only reason the access token will expire is if the user removes your application or removes the offline access permission from your application.