Facebook access token with "never

I'm trying to get a Facebook access token that never expires but I cannot manage to do it. Here is my steps:

1) Use Facebook graph explorer to generate a short live access token with the desired permissions (this token is valid for 1h or so)

2) Get a long live token (2 months expiry time) by manual GET request to 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) An this tohttps://graph.facebook.com/[user-id]?fields=access_token&access_token=[long-live-access-token]

but that last steps show an error:

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

I have found that last step somewhere on the net so I presume FB must have change something, I have read their api doc but I cannot figure out by what resource they chance the step 3.

Could someone explain me how to get a user access token that never expires ?

thank you


User Tokens are never valid forever, an extended one is only valid for 60 days as you have found out already. I assume you want to get an Extended Page Token, that´s how you can get one:

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

Basically, you just need to use a Page ID, it does not work with a User ID.

链接地址: http://www.djcxy.com/p/70388.html

上一篇: init导致内核paniC

下一篇: Facebook访问令牌与“从不