如何刷新访问令牌。不打开图形 API 浏览器?在 facebook GraphAPI 中

问题描述 投票:0回答:1

根据 https://developers.facebook.com/docs/instagram-basic-display-api/reference/refresh_access_token/ ,刷新长期访问令牌,您可以从用户访问令牌中获取该令牌。

我正在 URL 上调用 GET 请求

https://graph.instagram.com/refresh_access_token
  ?grant_type=ig_refresh_token
  &access_token={long-lived-access-token}

它回来了

Sorry, this content isn't available right now

有没有其他方法可以通过在 URL 上调用 GET 请求来自动刷新 access_tokens。

facebook instagram instagram-graph-api
1个回答
2
投票

如果您已经拥有

Long-lived access token
那么您无法手动刷新

当用户使用 Facebook 登录按钮登录时,您得到的是一个短期访问令牌,您可以使用此端点来获取长期访问令牌

curl -i -X GET "https://graph.facebook.com/{graph-api-version}/oauth/access_token?  
    grant_type=fb_exchange_token&          
    client_id={app-id}&
    client_secret={app-secret}&
    fb_exchange_token={your-access-token}" 

在您获得长期令牌后,如果用户正在使用您的应用程序,它会每天自动刷新一次,这意味着令牌正在被使用,如果令牌在 60 天后没有被使用,用户必须再次执行登录流程才能完成获取新令牌在此处了解更多信息

© www.soinside.com 2019 - 2024. All rights reserved.