gpt4 book ai didi

php - 更新长期访问 token 服务器端

转载 作者:可可西里 更新时间:2023-11-01 13:16:33 25 4
gpt4 key购买 nike

我们正在从 Facebook 正常检索长期存在的访问 token ,但是我们需要自动更新此 token ,以使其不会每 60 天过期。

阅读文档,它说您只能使用端点交换短期 token 。

由于我们没有短期 token ,我们如何才能在服务器端执行此操作而不必每 60 天手动重新授权一次?

最佳答案

无限扩展 token 是不可能的。请在此处查看场景 4 https://developers.facebook.com/roadmap/offline-access-removal/ :

Using the new endpoint below, you will be able to extend the expiration time of an existing, non-expired, short-lived user access_token. Please note, the endpoint can only be used to extend the short-lived user access_tokens. If you pass an access_token that had a long-lived expiration time, the endpoint will simply pass that same access_token back to you without altering or extending the expiration time.

To get the long-lived user access_token simply pass your own client_id (your app_id), your app_secret, and the non-expired, short-lived access_token to the endpoint below. You will be returned a new long-lived user access_token; this access_token will exist in addition to the short-lived access_token that was passed into the endpoint. If you would like to refresh a still valid long-lived access_token, you will have to get a new short-lived user access_token first and then call the same endpoint below. The returned access_token will have a fresh long-lived expiration time, however, the access_token itself may or may not be the same as the previously granted long-lived access_token.

关于php - 更新长期访问 token 服务器端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10651070/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com