Facebook Long-Lived Token: Looking for never expiring facebook page access token, facebook access token, facebook app token?Follow the complete guide on how to generate the never expiring facebook access token to use with Facebook’s graph API to consume the real-time data.
1. Create an app from https://developers.facebook.com/ . Give necessary information and create the app.
2. Create short lived user access token .
Go to tool explorer https://developers.facebook.com/tools/explorer/ and select the app created above and select “Get user access token in the drop down” .
Once you selected “Get user access token in the drop down” it will prompt following pop up . There you can select the permission(scopes) for the user access token.
Here I have selected “publish pages” and “manager pages” scopes which are need to create non expiry page access token.
More detail about scopes can be found here
“This will create short lived user access token”
3. Create long lived user access token
Go to https://developers.facebook.com/tools/accesstoken/.There you will find short lived user access tokens and app access token of all the apps you have
Press debug option of user access token of the app created above. This will take you to the debug tool. Where you can find all the information of short lived user access token.
In the bottom there is option to generate long lived(60 days) user access token for this short lived user access token. Generate long lived user access token by selecting “Extend Access Token”
4. Create never expired page access token
b. Paste the long lived user access token generated in previous step inside “Access token” field.
c. Access “/me/accounts” api . This will result page access tokens and pages related to them. These page access tokens will never expire(until user change the password/user revoke the app)
5. Verify non expiry page access token
b. Add the page access token retrieved from above step into “Access token “ field and debug
You will get expires as Never
Facebook,API,Access Token,Page Access Token
Source: Jenananthan – medium.com