Search code examples
phpfacebookfacebook-javascript-sdkfacebook-permissions

Post to my facebook page as page admin using php SDK


My main idea is to fetch my posts database of my website and post it all to my facebook page as page admin ...

and basically I wanted to be able to post to my facebook page from my website using php sdk I tried a lot but it always gives me this permissions error when I try to login using facebook from my website :

enter image description here

Any way I click okay and redirect to the callback url ... but when I send the post I want from my website to the facebook page it gives me this error :

Fatal error: Uncaught OAuthException: (#200) The user hasn't authorized the application to perform this action thrown in /home/alsouqe/public_html/postinfb/src/base_facebook.php on line 1243

I tried to contact facebook for an app review but they answered me twice by you don't need these permissions to post to your page since you're the admin of the page ( and I am) so I'm confused about that what should I do to make that work ?

the permission I'm sending in the request are :

email,publish_actions,manage_pages

Solution

  • Posting as Page needs the publish_pages permission. You have to authorize with publish_pages and manage_pages, and then you have to use a Page Token. You get one with the /me/accounts endpoint.

    And no, you do not need to go through the review process if only you will use the App. Just ignore the warning in the login popup.