Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Generating app_token

Open
#23 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

No repository file or test is named. Start by reproducing the two requests in Python with the documented app credentials, compare their responses with the manually generated token flow described in issue #3, and consider the work done when the programmatic flow reliably produces a token that can retrieve political ads and be extended.

Written by the indexing model from the issue text.

Description

Currently I generate an access token in pretty much the same steps as @skylarcheung outline's here however I'd like to try to do this programatically instead of manually every 60 days. With access to the app id and secret, what call would I need to make to get the token, and then extend it?

Currently trying the following to get the token:
response = requests.get(f"https://graph.facebook.com/oauth/access_token?client_id={app_id}&client_secret={app_secret}&grant_type=client_credentials")
but the returned app_token does not work when I try to pull political ads data or try to extend it:
second_response = requests.get(f"https://graph.facebook.com/oauth/access_token?client_id={app_id}&client_secret={app_secret}&grant_type=fb_exchange_token&fb_exchange_token={app_token}")

(I am verified and when I manually generate the token and extend it I am able to pull ads without issue)

Dominant language
Python
Stars
338
Forks
131
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from facebookresearch/Ad-Library-API-Script-Repository

All issues in facebookresearch/Ad-Library-API-Script-Repository

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.