Generate Page Access Token for Facebook Page & Facebook App
Generate Page Access Token for Facebook Page & Facebook App

Generate Page Access Token for Facebook Page & Facebook App

Author
Created
Mar 15, 2024
Tags
Facebook integration
Page access token
Text
A guide to generate page access token for your Facebook app used by external applications.

💡
Prerequisites: 1. You should have the valid Facebook Page. 2. You should have the valid Facebook App.
Go to your Facebook app page, and open the Graph API Explorer. (Tools → Graph API Explorer )
notion image
You will redirected to the Graph API page, where you need to select the Meta App dropdown list, and pick the name of the app that you created before as mentioned in the prerequisites.
notion image
Select Page name from User or Page dropdown selection options, under Page Access Tokens

notion image

Select necessary permission required by this token. Selecting permission are totally depends on the use case on which you are going to use this token. For E.g. if this page access token is used for extracting the Pages’s post and its comments, then select following -

notion image

Click on Generate Access Token button, this will prompt you to authenticate with your Facebook credentials and link your account to your Facebook page.
After successfully authentication from your Facebook credentials, it will generate the token as below.

notion image

Please note- the generate token is short term token only valid for few minutes (40 to 60 mins). We need to generate the long term token from this.
Copy the token and go to the tools → Access token debugger , and then paste your token as below and click debug button.

notion image

You will notice the details of your token, that represents the token validity, permission with Facebook page, admin user, etc.

notion image

At the bottom click on the Extend Access Token button. After authenticating with Facebook credentials, it will generate the long term token. Now use this token in the your application.

notion image
 
Remember to generate again the new token, before it expires.