Steps to create never expiring Facebook access token

Jul 4, 2018 / Updated on Jul 4, 2018

  1. Open Graph API Explorer https://developers.facebook.com/tools/explorer
  2. Select the required application in the “Facebook App” drop-down menu
  3. Select “Get User Access Token” under “User or Page” (this opens a popup)
  4. In the popup, grant access from a Facebook account that has access to manage the target pages (This popup will flash and disappear if permissions are already granted)
  5. Make sure “manage_pages” and “publish_pages” (optionally pages_show_list) are selected under “Add a Permission”, if not select them
  6. Click “Generate Token”
  7. Copy the token that appears in the “Access Token” field (which is your short-lived access token)
  8. Invoke the following URL which gives long lived token (expires in 2 months): https://graph.facebook.com/oauth/access_token?client_id={app_id}&client_secret={app_secret}&grant_type=fb_exchange_token&fb_exchange_token={access_token_from_previous_step}
  9. Copy the access token for the required page
  10. Invoke the following url which gives never expire token https://graph.facebook.com/{page-id}?fields=access_token&access_token=
  11. Validate the token using https://developers.facebook.com/tools/debug/accesstoken={token-from-previous-step}
  12. Note:
  13. Expires will have value Never and Data Access Expires will have 3 months, do not worry about Data Access Expires, because manage/publish pages permission will not expire though the Data Access expires
  14. Make sure validator show Valid as True
comments powered by Disqus
Categories:
Tags: