How to Create long lived Facebook Access Token that never expire?

By default, Facebook Access Token generated is temporary in the sense that it is valid for a limited time period (couple of hrs.), after which if not extended, it will expire and you have to go through the process of creating an Access Token again.

However Facebook provides a way to extend these token to a period of 60 days. To make an existing short lived Access Token to a long-lived Access Token that doesn’t expires soon, please follow the below steps;

Creating a long lived User Access Token

Method-1

  1. Go to https://developers.facebook.com/ to login into your Facebook developer account.
  2. Once signed in, navigate to the top-right corner and click on 'My Apps' menu, to select the app you have created. This will open developer dashboard of your apps.
  3. Go to 'Tools' menu and click on 'Graph API Explorer' to open it.
  4. Navigate to 'Access Token' section, on the right side of the page.
  5. Select your Facebook App from the drop down menu, under 'Access Token' section and then select 'Get User Access Token' or 'Page Access Token' from the drop-down menu, under 'User or Page' section in the drop down
  6. Copy your short lived Access Token, which you had created earlier.
  7. Go to 'Tools' menu and click on 'Access Token Debugger' to open it.
  8. Paste your short lived Access Token in the field as shown below and click on 'Debug'.
  9. You will get an overview of the Access Token, including expiry details of the token. Scroll down to the botton of the page and click on 'Extend Access Token'
  10. Your long lived user Access Tokens will be generated, with validity of about 60 days!

Method-2

  1. Login into your Facebook developer account.
  2. Go to https://developers.facebook.com/tools/accesstoken/ to find short lived user Access Tokens and app Access Token of all your apps. As mentioned above, you must be logged into your Facebook developer account.
  3. Click on debug option of the user Access Token of the app you have created. This will take you to the debug tool, where you can find all necessary information regarding short lived user Access Token.
  4. The access token will be extended for 60 days(2 months), unlike before, when you had to manually generate long lived user Access Token from your existing short lived user Access Token.

If you don’t have a Facebook Access Token yet, you can get one easily. Read - How to get Facebook Access Token?

Troubleshoot Errors

⦿ Certain times, the above process may give errors. In this case you may have to go through the process again and then submit it for review. Once reviewed, the Access Token will be extended.

⦿ In case you have not given permissions for your app, the 'Debug' option will not appear. You need to first give permissions to the app, before extending the access token.

⦿ Another thing you can do is go to the Access Token Debugger section and test your long lived Access Token. This will save you lot of time and energy.

How to create a never expiring Facebook Access Token?

The first time you extend a short lived Access Token to a long lived Access Token, it is extended for 60 days, after which it gets auto renewed.

What this means to you, is that you need not renew the Access Token manually everytime, and can use them for projects, without worrying about expiry of the tokens.

You can copy and use these auto-renewing Access Tokens in anyway, which will never expire until the user (admin of the app) changes the password of their Facebook developer account or may choose to revoke the app.

How to verify Page Access Token expiry?

To verify the Page Access Token’s validity, please go through below steps;

  1. Go to https://developers.facebook.com/tools/debug/accesstoken/. As always, you must be logged into your Facebook developer account.
  2. Copy the page Access Token retrieved from above process and paste it into “Access Token“ field and click on debug option.

This will confirm, the validity of the Access Token.

It is worth remembering that the Access Token will as ‘never expire’ only when it gets auto renewed automatically, condition to;

  1. The password remains unchanged for your Facebook account.
  2. Your Facebook account is not affected by any Facebook security issues / updates.

If case your Page / Event feeds are not syncing properly, you need to re-enter page Access Token values, so that the data will appear correctly. This way, it will update every hour and will also show the past data properly.