1

I am trying to develop a app which will post on user's Facebook page.

Steps I followed are: 1.Created a fb App, with permission : manage_pages and publish_actions

image

2.Redirected user to 'https://www.facebook.com/dialog/oauth

With parameters:

client_id=FACEBOOK_APP_ID
redirect_uri=FACEBOOK_REDIRECT_URL
scope=manage_pages,publish_actions

Where user allowed app against each permissions

image image

3.On call back url (FACEBOOK_REDIRECT_URL), cought CODE sent by facebook api

4.Now I sent get request to url = https://graph.facebook.com/oauth/access_token with parameters:

'client_id':FACEBOOK_APP_ID
'redirect_uri':FACEBOOK_REDIRECT_URL
'client_secret':FACEBOOK_SECRET_KEY,
'code':CODE

from respose sent by facebook, I filtered TOKEN

5.sent get request to url = https://graph.facebook.com/me/accounts. with parameters:

'access_token':TOKEN

from response I received, I saved page id as PAGE_ID, page_token as PAGE_TOKEN

6.I tried to post something on user's facebook page, I sent post request to url = https://graph.facebook.com/PAGE_ID/feed , with parameters:

'access_token':TOKEN'
'message': MESSAGE_TEXT,


Snap! in response I received:

{
  "error": {
    "message": "(#200) The user hasn't authorized the application to perform this action", 
    "type": "OAuthException", 
    "code": 200
  }
}

I couldn't figure out What mistake I am committing, Do I need to get my app reviewed before posting ? If yes, How can I test my app?

I also tried this by creating a test user. I got the same error.

varnothing
  • 1,269
  • 1
  • 17
  • 30
  • just open the permission dialogue with the publish_action permission then update your access token and then post your message – dhana May 26 '14 at 08:52
  • This makes no sense, your user needs to approve you to post to their wall. If they only login they only grant you the most basic permissions exclusive of posting to their wall. – dhana May 26 '14 at 08:54
  • @dhana User deleted the the app from setting>apps, and reauthorized it, this made not any difference. I edited the question and inserted screenshot. How can I test the posting on wall functionality of the app? Thanks – varnothing May 26 '14 at 10:13
  • See this http://stackoverflow.com/questions/15796138/why-does-posting-to-facebook-page-yield-user-hasnt-authorized-the-application. It might be helpful – dhana May 26 '14 at 10:19
  • @dhana Thanks bud! `status_update` permission was not visible from app control panel, that's why I was sceptic. But sending this in scope parameter solved my issue! – varnothing May 26 '14 at 11:21

1 Answers1

1

Thanks to @dhana,

In order to Post on a facebook page, App need manage_pages and publish_action app centre permission, and manage_pages , publish_action and status_update scope while requesting

url = https://www.facebook.com/dialog/oauth?\
    client_id='+FACEBOOK_APP_ID+'&\
    redirect_uri=' +FACEBOOK_REDIRECT_URL+'&\
    scope=manage_pages,publish_actions,status_update
Community
  • 1
  • 1
varnothing
  • 1,269
  • 1
  • 17
  • 30