存储在 cookie 中的 facebook javascript sdk 访问令牌的有效性是什么

发布于 2024-09-27 09:39:08 字数 230 浏览 10 评论 0原文

如果我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伴梦长久 2024-10-04 09:39:08

是的,如果您向用户请求“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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文