How to create Facebook’s Long Lived access token?

Image of Facebook

For posting to facebook’s page from the script you would need the long lived access token, normal access token will allow you to use it only once.

Following are the steps on how you can create the long lived access token?

1. Visit https://developers.facebook.com/tools/explorer/145634995501895/
2. Under application select the facebook application you want to use and make a note of App ID & Secret Key.

Image for steps to Get App ID And Secret Key
3. Click on get access token and then select extended permissions, manage_pages, publish_pages & publish_actions for getting access token as shown below

Image of how to Select App For Access Token

Image of How To Go To Get Access Token

Image of How To Set Permissions For Token

4. Get-> type in /<page_id>?fields=access_token and hit submit you will receive access token. Save this as we will use in next step.

Image of How To Get Short Lived Token

5. Under graph API use oauth/access_token with POST method and following parameters

a) grant_type = fb_exchange_token
b) client_id = <app id>
c) client_secret = <app secret>
d) fb_exchange_token = <access token you just received>

Click submit and you should receive access_token which is long lived access token

Image to Create Long Lived Access Token

For detailed visual steps you can view below video or visit video https://www.youtube.com/watch?v=xNFtjkLrQKM

About author

Love coding, crazy about logic, like solution architecting and solving problems. Thirsty for knowledge, challenges & most importantly innovation. One of the passionate brain behind SpryOX

Leave a Reply

Your email address will not be published. Required fields are marked *