-1

Facebook apps require a "never-expires" access code how to get one?

Manuel Lema
  • 69
  • 1
  • 7

2 Answers2

2

This is how you get one:

  1. Create Facebook App via the FB Developers site
  2. Grab your APPID, APPSECRET, USERTOKEN
  3. Go here: https://graph.facebook.com/v2.9/oauth/access_token?grant_type=fb_exchange_token&client_id=APPID&client_secret=APPSECRET&fb_exchange_token=USERTOKEN
  4. Grab the access token generated on step3 and replace it here: https://graph.facebook.com/PAGEID?fields=access_token&access_token=ACCESSTOKEN
Manuel Lema
  • 69
  • 1
  • 7
1

Make sure you understand the difference between Tokens, there are App Tokens, User Tokens and Page Tokens, for different purposes.

There is only one token that does not expire: The App Access Token. You don´t need to generate it, it´s just "App-ID|App-Secret" (with a pipe sign in the middle).

Page Tokens are not always valid forever anymore, as you can read in the docs https://developers.facebook.com/docs/facebook-login/access-tokens/expiration-and-extension

If the User access token you use to retrieve this Page access token is a long-lived token, you get a long-lived Page token that is good for at least 60 days.

However, if you use a Page administrator token and your app has business permissions, the returned Page access token does not expire.

So, in order to get an Extended Page Token (that is valid for 60 days or forever), these are the steps:

  • Authorize with manage_pages (and other permissions you may need)
  • Extend the resulting User Token to get an Extended User Token
  • Use /page-id?fields=access_token with the Extended User Token to get an Extended Page Token for a specific Page, or /me/accounts?fields=access_token to get Extended Page Tokens for all the Pages you manage.
andyrandy
  • 72,880
  • 8
  • 113
  • 130