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

Generating app_token

Offen
#23 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
337
Forks
130
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Currently I generate an access token in pretty much the same steps as @skylarcheung outline's [here](https://github.com/facebookresearch/Ad-Library-API-Script-Repository/issues/3#issuecomment-638988172) 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)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.