Skip to content

Instantly share code, notes, and snippets.

@leilaylp
Last active October 3, 2019 13:18
Show Gist options
  • Save leilaylp/d63a04164752677488fe2ac823f73f85 to your computer and use it in GitHub Desktop.
Save leilaylp/d63a04164752677488fe2ac823f73f85 to your computer and use it in GitHub Desktop.
Get a never-ending Facebook Access Token

How to get a never-ending Facebook Access Token

First you need:

  • APP ID
  • PAGE ID
  • Create any page access token using the Graph API Explorer. This is called a short-lived token.

Step 1. Generate a long-lived access token

  • Go to the Access Token Debugger
  • Paste the short-lived token in the input text and debug it.
  • Below you would find a 'Extend token' button. Press it and get the long-lived token.

Step 2. With the page_id and the long-lived access token you can generate a new acces token but this will be live forever running this URL from the graph explorer debugger identified as the associated Facebook App + the Page Access Token: PAGE_ID?fields=access_token&access_token=LONG_LIVED

Now you can debug it with the debugger tool and check that the token doesn't expire :D.

...and that's all :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment