How to Generate a Never Expiring Facebook Page Access Token

Yasith Lokuge
Aug 10, 2018 · 4 min read

Background

Due to ongoing changes in Facebook API caused by Cambridge Analytica data leak, apps have lost access to public posts & event API. Hence no posts or events are returned when using an app access token, if the app is not verified by Facebook.

Solution

As a solution, never expiring page access token can be retrieved as per the instructions listed in the following steps.

Caveats

  • User needs to be both page admin and the app admin.
  • Page access token will be invalidated if the user (admin) changes his/her password.

Steps

  1. Sign up for Facebook developers portal and create a new app. (You can skip this step if you already have an app)

2. Go to DashboardSettingsBasic and copy the App ID and App Secret.

3. Navigate to Facebook Graph API Explorer, to generate short-lived access token.

  • Select your app from Application drop-down.
  • In the next drop-down select Get user access token.
  • Now you will see a pop-up window like below. There you will be able to select the permission(scopes) for the user access token.
  • Select manage_pages and pages_show_list permissions. If you would like to understand more about the permissions visit permissions documentation
  • Generate user access token by clicking on “Get Access Token” button. This will open a popup where you need to select the relevant page you manage.
  • After clicking Next it will display the confirmation page with the requested permissions.
  • Click Done. This will create short-lived user access token.

4. Navigate to Access Token Tool, and click debug button at right side of the user access token for the current app (for which we are trying to create a long-lived access token)

5. This will navigate you to Access Token Debugger, where you will see the full information for the short-lived user access token. Note that short-lived user access token expires after an hour.

6. To extend the expiry date, Click on Extend Access Token at the bottom of the page and you will get the long-lived access token. Copy this new long-lived access token to use in the next step.

Note: If you don’t see the “Extend Access Token” button and your token expires in two months, that means you already have the
long-lived access token. You can skip this step and go to step 7.

7. Now, go to Graph API Explorer and paste the recently created long-lived user access token in the Access Token field. You need to change the API endpoint to access /me/accounts and click on Submit button. This process will show the result with all pages information including page access token i.e never expiring token. Copy the access token of the relevant page.

8. Now you can verify if the page access token is never expiring. Go to Access Token Debugger and paste the never expiring access token you received from the above step and click Debug.

Conclusion

By following the above steps, you will be able to get a never-expiring page access token which you can use with your own page integrations.

Buy me a coffee
Buy me a coffee
Yasith Lokuge

Written by

I am an energetic and enthusiastic individual who is driven towards realizing personal goals with self motivation.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade