Extending Facebook Expiration Tokens

The world of Facebook development is vast and complicated, especially with how quickly everything changes. All the API’s and SDK’s can be a pain to keep up with. When I first got involved with FB integration I honestly felt like I was learning a new scripting language. But fortunately these days everything is pretty well documented under the “Docs” section of the official FB Developers page. If you are just getting into FB app development familiarize yourself with access tokens and permissions.

Access tokens are basically the keys to the kingdom as far as exchanging information between the client, your server, and Facebook. Tokens regulate the information apps have access to and which operations can be performed. There are four primary types of tokens: User, App, Page, and Client. User tokens come in two forms, short-lived and long-lived. Short-lived tokens usually have a lifetime of about an hour or two, while long-lived tokens usually have a lifetime of about 60 days.

Depending on what you are trying to accomplish with your app you may need an extended expiration token. Follow this quick guide to extend the expiration of your Facebook access tokens. If you already have your App ID, App Secret, and the access token you want to extend skip to step 9.

1) Go to Facebook Developers and open your App’s dashboard. You will need your App ID and Secret later.

app dashboard

2) Go to Facebook Explorer using your personal Facebook account in a new tab.

3) Click Graph API Explorer then select the app that you want to create an access token for from the drop-down. (The application “Example” is used below)


4) Click on Get Access Token.


5) Check any User Data Permissions you may need, then click Extended Permissions.


6) Check manage_pages and read_stream box and click Get Access Token.


7) Click OK when the prompt appears. If the app is managing a page as well a second prompt will appear to verify permission. (Note: App review submissions are not necessary for apps managing pages you have created)


8) You should now see an Access Token generated for you.


9) Copy and paste the URL below in a new tab. Replace the URL’s app id and secret with your App ID and App Secret from Step 1. Next replace the URL’s access token with the Access Token created in the previous step, and click enter to open the new URL.

https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id=App ID&client_secret=App Secret&fb_exchange_token=Access Token

10) Congratulations, you have just created an extended access token! Copy and paste the new token the URL generated in the previous step into the Graph API Explorer Access Token field and click Debug. The expiration time should read 60 days.



Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>