Facebook apps require a "never-expires" access code how to get one?
How to generate "never-expires" Facebook access token
2.7k Views Asked by Manuel Lema AtThere are 2 best solutions below
On
Make sure you understand the difference between Tokens, there are App Tokens, User Tokens and Page Tokens, for different purposes.
There is only one token that does not expire: The App Access Token. You don´t need to generate it, it´s just "App-ID|App-Secret" (with a pipe sign in the middle).
Page Tokens are not always valid forever anymore, as you can read in the docs https://developers.facebook.com/docs/facebook-login/access-tokens/expiration-and-extension
If the User access token you use to retrieve this Page access token is a long-lived token, you get a long-lived Page token that is good for at least 60 days.
However, if you use a Page administrator token and your app has business permissions, the returned Page access token does not expire.
So, in order to get an Extended Page Token (that is valid for 60 days or forever), these are the steps:
- Authorize with
manage_pages(and other permissions you may need) - Extend the resulting User Token to get an Extended User Token
- Use
/page-id?fields=access_tokenwith the Extended User Token to get an Extended Page Token for a specific Page, or/me/accounts?fields=access_tokento get Extended Page Tokens for all the Pages you manage.
This is how you get one: