问题
Firstly, apologies for the fact that this is a rather convoluted question. I have search the site to see if it has been asked before, but, while there are several that are similar, none of them relate to this specific problem.
I am trying to set up the ability to post as a Facebook page using the Page API. I have gone through the following process:
- Create an App
- Create a Page linked to the App
- Added the Page to my Facebook Business Manager account
- Set myself as the administrator of the Page
- Obtained an Access Token for the App
However, when I try to interact with the page in any way, I get an error. What appears to be the issue is that the API does not recognise me as an admin of the page.
This is not a coding issue. I have tested it with both the SDK and hand-rolling the necessary API calls with curl, as well as using the online Graph Explorer tool. The error messages are identical in all cases. I have also tested it with deliberately invalid credentials to check that it is not an authentication issue.
If I perform the '/me/accounts' API action, using either the Graph Explorer or my own code, I correctly get back my account details and all the pages I have access to. However, my new page is missing from the list. I can see all my previously created pages, but not this one. This would seem to imply that I am not an admin of the page.
But... when I visit the page on the web, I am an admin. I have full access to all the admin functions. It also appears in my list of pages in the Pages Manager app on Android.
I apologise of this is possibly an RTFM question, but I have scoured the documentation for any hint as to what I am doing wrong, and have found nothing helpful.
One final point, just for clarity, the app is still in development and hasn't yet been submitted for approval. But that shouldn't be an issue, I'm only testing it with API calls that should work without approval. And the app successfully interacts with other pages I own, provided I restrict it to calls that do not require approval.
Can anyone suggest what I may have missed? How can I get the API to recognise that I am an admin of the newly created page?
回答1:
OK, I am officially a numpty. A bit more searching reveals that this is currently a known bug.
https://developers.facebook.com/support/bugs/283375049150375/?disable_redirect=0
The issue is that previously granted permissions do not apply to newly created pages, only existing pages. The workaround is to delete all current permissions (either via the API or Graph Explorer), and then re-enable them.
I have tested this, and it works. My problem is solved. I can now administer my new page via the API.
来源:https://stackoverflow.com/questions/52889519/new-facebook-page-not-visible-to-api