Home Auto Posting to Multiple Facebook Pages using Graph API - Auth Issues
Reply: 1

Auto Posting to Multiple Facebook Pages using Graph API - Auth Issues

MarcA
1#
MarcA Published in 2018-02-12 17:19:32Z

I am pulling my hair out trying to understand what Facebook wants me to do to post to a FaceBook Page as a System User that has Admin and Page Privileges to and Owned by our business (We have Facebook Business Manager).

In a nut shell all I want to do is make this call:

https://graph.facebook.com/v2.5/${MyPageID}/feed

What I don't get is the access_token part. I can generate access tokes for Apps, for Pages but all result in 403 returned from FaceBook. I have gone as far and checking every box available on the generate access token popup on the graph api and still I get 403 "Forbidden" so I am detailing the little I understand of the insanity that is FaceBook Auth in the hope that someone can explain where I am going wrong.

1) To Post as a System User to a Page I have to Create a FB App (I Would prefer just to post direct to the pages and skip the App part, My System User has Admin Access on All pages)

2) To Access the App I need an App Token.

3) To Create an App token I need a User Token.

4) To Create a user token I need to log in to Facebook and have all sorts of permissions on the App. (I can't log in as the System User! FB asks me to login as myself. I am not sure if this breaks the Auth Token generated?)

5) Then there are all sorts of swapping tokens to get a Permanent App token, Another point of potential failure!

6) IF the stars and moon align and you stand on your head the permanent App key can be passed to the above call as the access_token

I don't understand how to link the Pages I want to post to with the App created. Do I have to have 1 App for Each Page?

I have got one page to work, We initially used that App to Auth against the Instant Article Graph API:

https://graph.facebook.com/v2.5/${MyPageID}/instant_articles

I could not use the above token for the /feed url, I had to generate a new token with extra publish permissions and the page published with no problems, however when I change the ${MyPageID} to another page using the same access_token I get the 403.

I tried Creating a new App, I have no clue how they link to a specific page So the App to me seems sort of redundant.

Any help with what I am doing wrong or how I can go about simply posting to various FB Pages with a System User using the /feed api ?

The calls are made form a Spring Boot Java APP using HTTP Posts.

MarcA
2#
MarcA Reply to 2018-02-15 02:17:24Z

How to get a System User Auth and Page Auth:

1) Generate a User Token for an App (Button above the System User):

https://business.facebook.com/settings/system-users/${System User ID}?business_id=${your_business_manager_id}
  • System user has Page Admin on each page you need to post to.
  • App is just an FB app, not sure what it does other that it is a grouping I generate a token against.
  • I chose: (manage_pages, publish_pages, publish_actions, pages_manage_instant_articles, pages_show_list)

2) Check your access token:

https://developers.facebook.com/tools/debug/accesstoken/?access_token=${The access token you got from the step above}&version=v2.12
  • This will provide you with the App ID the Token is for and how long it lasts (we need a Permanent token)

3) Using Graph API Explorer gets the Accounts this token has access to:

https://developers.facebook.com/tools/explorer/${Your FB APP ID}/?method=GET&path=me%2Faccounts&version=v2.12

4) Using the output above find Page Auth for each page you wan to publish to

5) Post to each page in turn:

https://graph.facebook.com/v2.5/${MyPageID}/feed
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.309699 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO