Reputation: 432
I am using the Facebook -registration with the PHP-SDK libraries. The registeration processes is working correctly. I am storing the Facebook userid,user_access_token in my user table. I am integrating the Facebook Feed posting for the user reviews in the website.When the user made some reviews we need to update his Facebook Feed (Wall) without asking his FBlogin again, instead we have to use his existing access_token stored in the Database.
I am using the following lines of codes to do so,
$facebook->api("/".$usid."/feed", "post", array("access_token" => $accestoken, "message"=>"Welcome to the site, review ...!"));
But I am always getting the following error:
#200) The user hasn't authorized the application to perform this action thrown in facebook.php on line 543
Upvotes: 0
Views: 5727
Reputation: 858
The message is displayed because you have not requested the permissions to publish to the user's wall (publish_stream).
You can do that by authenticating the user in facebook
https://www.facebook.com/login.php?api_key=1234567890&cancel_url=http://www.yoursiteurl.ro/facebook_cancel/&next=http://www.yoursiteurl.ro/facebook_login/&fbconnect=1&return_session=1&session_version=3&v=1.0&display=page&req_perms=user_about_me,user_birthday,publish_stream,offline_access
next_url will be the url where facebook will return the user access token store in the session object, after the user has authorized your application.
publish_stream allows you to post to user's wall, while offline_access will provide you an access token that you can save and does not expire, so you can publish to user's wall anytime.
For a list of available permissions, take a look at http://developers.facebook.com/docs/authentication/permissions/
Upvotes: 2
Reputation: 7779
The access token is invalid, you'd have to get a new one by taking the user though the OAuth flow.
Upvotes: 0