6
votes

We are retrieving the long lived access token from facebook fine, however we need to renew this token automatically so that it does not expire every 60 days.

Reading the documentation it says you can only exchange short lived tokens using the endpoint.

As we don't have the short lived token, how can we do this server-side without having to manually re-authorize every 60 days?

1

1 Answers

9
votes

it is not possible, to extend token endlessly. See Scenario 4 here 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.