"never-expire" 的 Facebook 访问令牌

Facebook access token with "never-expire"

我正在尝试获取永不过期的 Facebook 访问令牌,但我无法做到。这是我的步骤:

1) 使用 Facebook Graph Explorer 生成具有所需权限的短期实时访问令牌(此令牌有效期为 1 小时左右)

2) 通过手动 GET 请求获取一个 long live token(2 个月到期时间) https://graph.facebook.com/oauth/access_token? grant_type=fb_exchange_token& client_id=[app-client-id]&client_secret=[app-secret-id]& fb_exchange_token=[short-live-access-token]

3) 一个这个到 https://graph.facebook.com/[user-id]?fields=access_token&access_token=[long-live-access-token]

但最后一步显示错误:

{
  "error": {
    "message": "(#100) Tried accessing nonexisting field (access_token) on node type (User)",
    "type": "OAuthException",
    "code": 100,
    "fbtrace_id": "DpmM6CyzoAt"
  }
}

我在网上的某个地方发现了最后一步,所以我认为 FB 一定改变了什么,我已经阅读了他们的 api 文档,但我无法弄清楚他们通过什么资源获得了第 3 步。

有人可以向我解释如何获得永不过期的用户访问令牌吗?

谢谢

用户令牌永远不会永远有效,您已经知道,扩展的令牌只有 60 天有效。我假设你想获得一个扩展页面令牌,这就是你如何获得一个:

https://graph.facebook.com/[page-id]?fields=access_token&access_token=[long-live-user-token]

基本上,您只需要使用页面 ID,它不适用于用户 ID。