有没有办法检查 Facebook 访问令牌是否仍然有效? [英] Is there a way to check if Facebook access token is still valid?
问题描述
我的网站使用终身访问令牌 (offline_access
).但是,如果用户更改了他/她的密码,访问令牌将被重置.是否有一种方法可以在调用 Graph API 之前检查当前访问令牌是否有效?感谢您抽出宝贵时间.
My site utilizes lifetime access tokens (offline_access
). However, if the user changes his/her password, the access token gets reset. Is there a method to check if the current access token is valid before making calls to the Graph API? Thanks for your time.
推荐答案
基本上,FB 希望您对其进行轮询,或者检测案例并重定向用户以进行重新验证.烦人,但官方:
Basically, FB wants you to poll for it, or to detect the case and redirect the user to get a reauth to occur. Annoying, but official:
(旧的、过时的链接.见下文) https://developers.facebook.com/blog/post/500/
Facebook 在没有重定向的情况下更改了他们的链接结构.不意外.
Facebook changed their link structure without redirects. Not surprised.
https://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/
这篇关于有没有办法检查 Facebook 访问令牌是否仍然有效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!