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
)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.Select Page name from
User or Page
dropdown selection options, under Page Access Tokens
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 -
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.
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.You will notice the details of your token, that represents the token validity, permission with Facebook page, admin user, etc.
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.Â
Remember to generate again the new token, before it expires.