Generate a never-expiring Facebook page access token

A never expiring page access token should be used when configuring a Facebook data source. This avoids Facebook’s app verification requirements which will prevent the Facebook data source from updating. The token can be retrieved by following the instructions listed below.

  1. The user generating the never expiring token needs to be the admin of both the page that is being gathered and the app.

  2. Page access tokens will be invalidated if the user (admin) password is changed.

ON THIS PAGE

Steps

  1. Sign up for the Facebook developers portal and create a new app. (You can skip this step if you already have an app)

    Create a new ID
  2. Go to Dashboard → Settings → Basic and copy the App ID and App Secret.

    Copy the App ID and secret
  3. Navigate to the Facebook Graph API explorer to generate short-lived access token.

  4. Select your app from Application drop-down.

  5. In the next drop-down select Get user access token.

    Generate a token
  6. Now you will see a pop-up window like below. There you will be able to select the permission (scopes) for the user access token.

    Select permission
  7. Select pages_show_list, page_events, manage_page_metadata, pages_read_engagement, pages_read_user_content and public_profile permissions.

    If you would like to understand more about the permissions, please visit permissions documentation.

  8. Generate user access token by clicking on get access token button. This will open a popup where you need to select the relevant page you manage.

    facebook page access token 9
  9. After clicking Next it will display the confirmation page with the requested permissions.

    facebook page access token 10
  10. Click Done. This will create short-lived user access token.

  11. Navigate to the access token tool and click the debug button at the right side of the user access token for the current app (for which we are trying to create a long-lived access token).

    Access token tool
  12. This will navigate you to access token debugger where you will see the full information for the short-lived user access token. Note that short-lived user access token expires after an hour.

    Access token debugger
  13. To extend the expiry date, Click on extend access token at the bottom of the page and you will get the long-lived access token. Copy this new long-lived access token to use in the next step. If you don’t see the btn::[extend access token] button and your token expires in two months, that means you already have the long-lived access token. You can skip this step and go to step 14.

  14. Finally, to get the never-expiring access token, go to the Graph API explorer and paste the recently created long-lived user access token in the access token field.

    You need to change the API endpoint to access /me/accounts and click on Submit button. This process will show the result with all pages information including page access token i.e never expiring token.

    Copy the never-expiring access token of the relevant page from the access_token field in the JSON result.

    Graph API explorer
  15. Optionally, you can verify if the page access token is never expiring. Go to the access token debugger and paste the never expiring access token you received from the above step and click Debug.

    Access token debugger
  16. Now you can use the access token obtained from the above step in collection.cfg using facebook.access-token collection configuration option.

By following the above steps, you will be able to get a never-expiring access token which you can use with the Funnelback Facebook collections.

© 2015- Squiz Pty Ltd