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

2

5

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?

Ascending answered 3/3, 2015 at 14:28 Comment(0)
J
7

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.

Juliajulian answered 3/3, 2015 at 16:3 Comment(4)
I need a FB app? Never made one, this is something that can be installed to some user profile and than he can do something inside browser? I don't see how to use Facebook app to automaticly download daily reports, i can only imagin someone clicking download report each day. Can you please explain this part please.Ascending
If you want to manually retrieve reports you can do so via the FB ads manager facebook.com/ads/manage or via the Power Editor facebook.com/ads/manage/powereditor. But to retrieve report data via the API you need an FB app. Authorize the app to read data from your ad account then setup code to automatically retrieve ad report data from the API and output. Checkout the FB guide developers.facebook.com/docs/marketing-api/guides/…Juliajulian
I was under impression that you could dl reports only from your sandboxed FB app running in browser, but if FB ap is just proxy that wires up FB infrastructure and enables you security credentials to invoke API from you native PC app than this is what I need. I'll check it some more. Thanks!Ascending
OMG I was using GET examples from FB documentation. All the time some strange authentication errors were coming, I was sure that I had something conceptually wrong. But now i tried same call 3 days later with short time token generated with Graph Explorer and everything is working OK. I just have to make 60 day token now.Ascending
F
-2
  1. Create a facebook app.
  2. Go to the Graph API Explorer in Facebook's Tools & Support section.
  3. Pick your app from the drop down.
  4. Hit Get Token > Get User Access Token.
  5. In Select Permissions choose required permissions or select them from extended permissions.
  6. Use the user access token that will be presented to you in the access token form input field.
Flin answered 21/1, 2016 at 15:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.