Post on Facebook Page Using FB Graph API using FB Live but un-reviewed App - facebook

I want to post on my own Facebook Page using Graph API.
For this, I have created an App.
When App is in Dev Mode, I am able to post on page using Page Access Token with proper permissions.
However, the problem here is, the post are not visible to public unless I make the App Live. The posts are only visible to Page Admins.
But as I make my App Live, I am getting below exception from FB APIs.
{
"error": {
"message": "(#200) If posting to a group, requires app being installed in the group, and \\\n either publish_to_groups permission with user token, or both pages_read_engagement \\\n and pages_manage_posts permission with page token; If posting to a page, \\\n requires both pages_read_engagement and pages_manage_posts as an admin with \\\n sufficient administrative permission",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "abcdefgh"
}
}
I regenerated the Page Access token after I make my App Live but still above error is coming.
I checked some resources which says that I need to submit my App for review. But I don't want to go through that lengthy process.
So, Is there any otherway with which I can post on facebook page using API without putting my App for review process ? Will any other kind of token (i.e. other than page access token) work here ?
Please note, I want to make sure the posts I make to be visible by everyone and not just page admins.

Related

Figure out which pages I got permissions for from the Facebook Login popup

I'm building a Chatbot and im trying to connect it with the client Facebook Fanpage programmatically, so I can you receive and send messages on the user behalf on the Fanpage.
So far all is good, I got the Facebook login to work, requesting access to the right permissions, and getting the user short and long lived access token.
However, I'm not sure this access token is valid for which Fanpages, The Facebook login lists all the user Fanpages and he can select which he will give the permission to per the screenshot, but nothing is returned in the payload saying which pages he selected, only the access token as below:
"authResponse": {
"accessToken": "EAAJ911mLyc4BAPsNTMCfVqcf5JkvnGsaZCxXZAZA6slQuubSaZANMB3jsUBZB5ds7opfAuV1ZBB5Vz3NZBLwiN3QO1C5NupvGAbIdzxz91JYWHZCJfwOgawzOswgxAevLDmd6yjRQ4LASROcbnyTtHcnBeE08qvWSYJ6sJrzZCptZB94NZA1tz6tVKOIZCIgrhdaM1IB4feF2LCaF86eIXH1yAZCE",
"userID": "2917511921114302",
"expiresIn": 5498,
"signedRequest": "YpjihSoIBgcl2fUxkVBE2b7_mtXD7RK7ZT7sn77uqRY.eyJ1c2VyX2lkIjoiMjkxNzUxODkyMTcxNDMwMiIsImNvZGUiOiJBUUFhNGVZRlJTUnIyNDkwT252dFdEYTlfTnh3cm1QWnNoTUF4bzNUYzdERS00MmZXT0pvTEY4XzUybUJ6VmhzeF81eG05VjFNZV33daVhvM3lQV1FscTE1czZoM25uYUpnTzdObGpxUkJhQTNpRnhtMTA1TFMtbVRPa0dTNGNiNEFpbXN3dTcxcEZiX0hjZG1MVXFldmo5QkVQMXJzYnRkYkw5LWNzSXZlWWIyWmZQR25TNW93aUdCTjRIZmRqdjRSbm9aMkllRDRPN3R1RUtfbmhDMG55cDd1UDZGR1JCOVFaV3ZQQUVEQTNwN2dJX0x3X1ZDYUsteG00Tk9BbkJhZEdnVS16eXJNR3J1S0owZWFLUFF6YkFkNWJRaUJzNmw1a2xvUl9IOFhieFpiMjlaUmJHTjBOUjJoZmk4bHNISU5yMW91SjUyXzJqWTNaTy1xZ3FSX1RObSIsImFsZ29yaXRobSI6IkhNQUMtU0hBMjU2IiwiaXNzdWVkX2F0IjoxNjc1OTUyOTAyfQ",
"graphDomain": "facebook",
"data_access_expiration_time": 1683728902
},
"status": "connected"
}
And screenshots for the page selection from the Facebook login:
How can I can get the pages id selected, so I can request later the page access token for those specific pages? Thanks.

Graph API doesn't return Page Events with a valid Page Access Token

Due to many Facebook's access policies changes, the question may seem duplicated, but it's not.
My application followed all facebook approval process, and at the moment it has been approved by the "App Review" to get "manage_pages" permission. This allows to obtain a "Page Access Token" which grants the access to the page events, wherever the user is Guest or Host. (Facebook manage_pages)
After switching from Development to Live mode, the /page/events endpoint returns an empty object, with all my granted users, with a valid longlive page access token.
{
"data": [
]
}
Has anyone ever encountered this issue?
Thanks.
Past references about this:
Facebook Graph API does not return Page Events
How can I get the events for a Facebook page?

Facebook App Admin cannot post Live Video API request on its own page

I'm using the Facebook Live Video API for testing purpose.
I've created a Test User, associated with my Facebook App, with the following permissions: publish_actions, user_videos, publish_pages, manage_pages
Using graph API explorer, I can make a POST request on /{user_id}/live_videos, using the Test User ID and Access Token (got it from the My App -> Role -> Test Users).
But, if I create a page with the Test User (logged in with its email), POST resquest on /{page_id}/live_videos, with the test user page ID and Page Access Token with required permissions, I get an error:
"message": "(#100) No permission to perform current operation.",
"type": "OAuthException",
"code": 100,
I have the exact same issue when I'm not using a Test User, i.e. when I try to post live videos on a page id with an admin page token, while it works on its user id with user access token.
I've followed these documentation:
Live Video API
Why can't I POST live_videos on page ID with a page access token while it works on user ID with user access token?
Best regards.
Nico
POSTing a live_video with the page access token should work now. After chatting with the engineers at FB, they fixed the problem, so it wasn't an issue with just you.

A user access token is required to request this resource

I've developed a Facebookapp that has the "user_photos" permission. Now i've submitted the App, which is now live. I've installed it on several Facebook-Accounts of my friends... (Yes! they have granted the requested permissions)
When i now try to make an request i get the following error message
{
"error": {
"message": "A user access token is required to request this resource.",
"type": "OAuthException",
"code": 102
}
}
Here's my Request-Query:
https://graph.facebook.com/LogInIDOfMyFriendThatHasInstalledTheAPP/?fields=albums.fields(photos,name,description),email&access_token=mySecretAppToken
Ok it works if I replace the App-Token with a User-Token that is generated by an OAuth-Process or via GraphAPIExplorer but in the Documentation (https://developers.facebook.com/docs/facebook-login/access-tokens/) it is said (in Paragraph) "App Tokens" that
"App access tokens are used to make requests to Facebook APIs on behalf of an app rather than a user. [...]" and that i have to generate an other "App Accesstoken" but this also does't work.
I'm confused...
So is there something i've forgotten / missunderstood or do I have to use the oAuth-Way which means that my friends have to reauthenticate to my App every two month???
Thanks a lot!
Best regards
Mike
A few lines after in the documentation it states
App access tokens can also be used to publish content to Facebook on behalf of a person who has granted a publishing permission to your application.
This is what they mean by requests on behalf of the user.
For the albums endpoint you need a user access token.
Yes your friends need to re-authenticate your app every two months if you extend a short lived user access token. The point is not to have apps sitting around with access when the user may have forgotten them. Prompting the user to re-authenticate ensures they are still aware of these apps and can have the choice to keep or delete them

Post on page with impersonate access_token?

I have a question, I'm trying to post on a page with the token acquired from
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&
grant_type=client_credentials
I guess the app has permission to post on that page, but when I try to post I get the following error
{
"error": {
"message": "(#200) The user hasn't authorized the application to perform this action",
"type": "OAuthException"
}
}
How do I verify the permission?
Basically, I want to be able to post to a page as a page without asking user to login, Would be great if someone can help me out!
The token that you are acquiring is an App Access Token.
And to post on a page as a page itself, you need a page access token.
To get the page access token, you need to make the following API call with an access token with manage_pages permission:
/{page-id}?fields=access_token
this will give you the page access token for your pages. Use that and publish the post.
You can also have a never-expiring page access token. To get one follow this: What are the Steps to getting a Long Lasting Token For Posting To a Facebook Fan Page from a Server