-
Notifications
You must be signed in to change notification settings - Fork 0
Generating Facebook access token
istewart edited this page May 25, 2018
·
10 revisions
Take a deep breath...
...
...now go.
APP_ID = application ID, located in the top toolbar on the app's homepage.
- Sign up as developer: https://developers.facebook.com/
- Create a business page: https://www.facebook.com/pages/creation/
- Create an app: https://developers.facebook.com/apps. The values don't matter.
- Activate the app by setting it to "Live" on the app's page: https://developers.facebook.com/apps/APP_ID
- Fill out the basic settings for the app: https://developers.facebook.com/apps/APP_ID/settings Again, the values don't matter, you just need to provide some proof of completion for approval. This also includes adding a platform for the app, which can just be a dummy URL.
- Submit the app for review to gain basic access for Ads Management: https://developers.facebook.com/apps/APP_ID/review-status/
You can skip this step if you just need a short-term token, but for a long-term token your app will need
ads_management
permission. - Once the app is approved, the Marketing API will be activated and you can generate a never-ending token as follows. Generate an access token with ads_management and ads_read permission: https://developers.facebook.com/apps/APP_ID/marketing-api/tools/
- Generate a user access token with the
manage_page
andpublish_pages
permission (click on the drop-down menu on the right and choose "Get user access token"): https://developers.facebook.com/tools/explorer/ - Find the user access token and click "debug": https://developers.facebook.com/tools/accesstoken/
- Click "extend access token" and copy the generated token.
- Paste the token into the "Access Token" field, and submit the call "me/accounts": https://developers.facebook.com/tools/explorer/
- Copy the value for the "access_token" field, paste it here: https://developers.facebook.com/tools/debug/accesstoken/, then click "debug".
- The token expire value should be "never". Go here: https://developers.facebook.com/tools/accesstoken/, click on "debug" for the user access token, and then click "extend access mode."
Note! When you're making API calls with this token, you need to use the app ID instead of your user ID, otherwise the access token won't work.