To get a long-lived access token for a Facebook page that does not expire:
Overview
- Get a “short-lived user access token”
- Exchange it for a “long-lived user access token”
- Use the “long-lived user access token” to obtain a “long-lived page access token”
Get a “short-lived user access token”
Go to Graph API Explorer
Under "Permissions", select
pages_manage_posts
andpages_manage_engagement
Click Generate Access Token. You will be prompted to log in and grant permissions. Select the pages you want to use the app with. Once authorized, you will get a user access token that expires in 1 hour.
Exchange it for a “long-lived user access token”
Copy the short-lived user access token
Go to Access Token Debugger.
Paste the access token and click Debug.
Click Extend Access Token. This will generate a long-lived access token that expires in 60 days.
Get a “long-lived page access token”
Copy the long-lived access token
Paste it back into the Graph API Explorer.
Using the explorer, perform a request: GET
me/accounts
. You will find the page ID, page name, and access token.
Since the access token is created from the long-lived access token, it will not expire (even if the user access token expires after 60 days).