Facebook应用程序的访问令牌是否过期?

问题描述:

这是与我的Facebook 应用程序相关联的访问令牌 - 从 https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=APP_ID&client_secret=APP_SECRET 。我可以从FB获得一次,并将其保存在某个地方以备将来使用,还是需要定期刷新?

This is the access token associated with my Facebook application -- the thing that comes back from https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=APP_ID&client_secret=APP_SECRET. Can I get this once from FB and save it away somewhere for future use, or do I need to refresh it on a regular basis?

对于每个用户令牌(这是您从链接获得的),都有一个到期日。使用其中一个令牌来 https://developers.facebook.com/tools/debug 并调试它。您将看到一般它们将在60分钟内到期。

For each and every user token (which is what you're getting from your link), there is an expiration date. Take one of those tokens to https://developers.facebook.com/tools/debug and debug it. You will see that generally they expire within 60 minutes or so.

要扩展该用户令牌,请调用exchange命令(https://developers.facebook.com/docs / offline-access-deprecation /),使其成为60天令牌。该用户令牌必须仍然有效(未过期)才能执行此操作。

To extend that user token, call the exchange command (https://developers.facebook.com/docs/offline-access-deprecation/) to get it to become a 60 day token. That user token has to be still valid (not expired) to do this.