0

I'm using facebook PHP SDK 3.1.1, an iFrame app can post on the logged on users wall who is already a fan of the page.

Following is the coe and it gives me error "Fatal error: Uncaught OAuthException: (#200) The user hasn't authorized the application to perform this action thrown in"

/*post starts*/
$attachment = array('message' => 'test message',
'name' => 'test app!',
'caption' => "Caption of the Post",
'link' => 'http://apps.facebook.com/phpsdk_demoapp/',
'description' => 'It is fun!',
'picture' => 'http://www.takwing.idv.hk/facebook/demoapp_phpsdk/img/logo.gif',
'actions' => array(array('name' => 'Start Learning', 
'link' => 'http://www.takwing.idv.hk/tech/fb_dev/index.php'))
);

$result = $facebook->api('/me/feed/',
'post',
$attachment);
/*post ends*/

I guess the part that takes permission from the user to post on his wall must be added to it, kindly help. Thanks

practitioner
  • 43
  • 2
  • 7
  • 2
    Obviously you are copying the code from an article or a forum without understanding the follow. I suggest you start reading the basics first ([authentication](http://developers.facebook.com/docs/authentication/) and [graph api](https://developers.facebook.com/docs/reference/api/) ) – ifaour Aug 26 '11 at 18:09

2 Answers2

0

Before user accessing your app you have to get user permission to wall post. This can be achieved by

http://www.facebook.com/dialog/oauth?client_id=" . <your app id> . "&redirect_uri=" . <app redirect url> . "&scope=publish_stream,offline_access'

This will give you access to post on users wall.

Ramkumar
  • 43
  • 1
  • 6
0

You have to get publish_stream permission: http://developers.facebook.com/docs/guides/policy/examples_and_explanations/Extended_Permissions/

Kaan Soral
  • 1,589
  • 1
  • 15
  • 31
  • All you need is oauth dialog: $auth_url = "http://www.facebook.com/dialog/oauth?scope=publish_stream&client_id=" . $app_id . "&redirect_uri=" . urlencode($canvas_page); This fixed my problem, so basically I was looking for this only as I mentioned in my post. – practitioner Aug 26 '11 at 20:05