How to create-extend access token for Facebook pages

1st of all you have to create an app where we will allow permissions like manage_pages and read_insights etc to have full access to pages tokens etc from that app. So let’s start and try to make it as simple as we can.

1- Create an App.

2- Click on Permissions link. Add the permissions like manage_pages, read_insights etc in the Extended permissions text box and Save.

3- Go to graph explorer and select the app we just created from the dropdown. Click on the get access token button. Check necessary permissions like in step 2.

4- Type this in Graph API me/accounts and it will show all the pages which this user/account administrator of with info like access_token etc.

5- Copy the access token and use it in your PHP scripts for that page. Now you will be able to pull that page data like total likes, total dislikes etc using insights etc.

By default the access token will last for few hours, and for pages we need to have long session for that token.

Extend the access_token by using this url:

APP_ID = The app id we granted permissions like manage_pages, read_insights etc.

APP_SECRET = The app secret we granted permissions like manage_pages, read_insights etc.

PAGE_TOKEN = The token of the page we want to extend.

After extending, facebook will issue new access_token, use that in the script. The new extended token will have 2 months time.

Check page access_token validity by using debug url:

Input the page access_token in the text box.

I will be writing another article on how to use the above app, page details in PHP and pull some page data. Stay tuned.

Leave a Reply

2 Comments on "How to create-extend access token for Facebook pages"

newest oldest most voted
Notify of
Steve Comrie

I think there’s a slightly alternative method that you can use that will result in a non-expiring Page Token.

Do Steps 1 & 2 as above, but then instead of getting the Page Access token, use your method to extend your initial User Token. That will get you a User Token that expires in 2 months.

Then using your new 2 month User Token, complete steps 3, 4, & 5 and you should end up with a non-expiring Page Access Token. Or at least, that’s what the Debugger tells me. Documentation from here seems to back me up:


Would it be more scalable to create an app and then have that app request the page ID and gain access to a access_token to multiple user created Facebook pages?

I’m trying to figure out a scalable option for monitoring friends business pages.