Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate Facebook Marketing API access token to use it in Windows application

I am using Facebook as advertising platform to promote my application on Apple and Google stores. I would like to make windows service which will download daily report(s) about advertising status of my marketing campaign running one Facebook, preferably using 60 day token, or some permanent solution so that token is retrieved when required. I think that i understand everything to do this except how to generate access token to use it with Facebook Graph API. Which token for which Facebook account do I need and how to obtain it?

like image 399
watbywbarif Avatar asked Mar 03 '15 14:03

watbywbarif


People also ask

How do I get an API token?

To get the API token for a user, an HTTP POST request should be sent to the Token resource. In the post body, username and password are specified in JSON format, and the response body contains a token key with an actual API Token as the value.

How can I get Facebook OAuth?

In the App Dashboard, choose your app and scroll to Add a Product Click Set Up in the Facebook Login card. Select Settings in the left side navigation panel and under Client OAuth Settings, enter your redirect URL in the Valid OAuth Redirect URIs field for successful authorization.


1 Answers

You'll need a Facebook app and to grant that app the ads_read permission in order to retrieve reports about your advertising efforts via the API (source).

You'll want a long-lived token so that you don't have to re-authenticate very often. The access token documentation details the steps to exchange a short-lived token for a long-lived one.

You may also want to consider managing the app, ad account, and access tokens (via a business system user) with the FB Business Manager.

like image 191
bjeavons Avatar answered Oct 29 '22 17:10

bjeavons