The user hasn't authorized the application to perform this action
Solution 1
Wow, I see this same question asked at least once a day.
You will want to ask for manage_pages
and publish_stream
. Once the admin of the page authenticates, query me/accounts
and grab the page's access token from that list. Using that page's access token, then you can post to me/feed
.
Solution 2
simple, u just need to ask permissions..that's it..
String[] permissions = { "offline_access", "publish_stream", "user_photos", "publish_checkins","photo_upload" };
mFacebook.authorize(MainActivity.this, permissions,
new LoginDialogListener());
Mokhlisse Badre
Updated on July 15, 2022Comments
-
Mokhlisse Badre almost 2 years
I am developing a simple java program to post automatically (articles) to my facebook fun page. I have created an app and have got an access_token using url : https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=APP_ID&client_secret=CLIENR_SECRET. I use this java code to post to fun page wall :
String url = "https://graph.facebook.com/" + PAGE_ID + "/feed" List<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair("access_token", accessToken)); nvps.add(new BasicNameValuePair("message", item.getTitle())); HttpClient client = new DefaultHttpClient(params); HttpPost httpost = new HttpPost(url); httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8)); HttpResponse response = client.execute(httpost); HttpEntity entity = response.getEntity();
I got this error:
{ "error": { "message": "(#200) The user hasn't authorized the application to perform this action", "type": "OAuthException" } }
How can I give my app authorization to post to my fun page ? thanks in advance
following recommendation of
-
Mokhlisse Badre over 12 yearsI got a user access_token for page administrator using url : facebook.com/dialog/oauth/…, then the post goes to page wall. But still have problem : sent post is "as administrator" not "as page" so it doesn't appear on people who likes my fun page, it appears on "Everyone (Most Recent)"
-
Mokhlisse Badre over 12 yearsI got access_token after admin authenticate application, but the message is posted as "admin" not "as page", this is important to show updates to people that likes my page. Thanks.
-
DMCS over 12 yearsHmmm, below you say just the opposite is what you're looking for "But still have problem : sent post is "as administrator" not "as page"" So which is it? Posting it as a page to the page, or as the admin to the page?
-
Mokhlisse Badre over 12 yearsshould use "page access token" as descr ibe in facebook doc page developers.facebook.com/docs/reference/api/page instead of user (admin) access token. Thanks Juicy Scripter
-
SharpXxx over 12 years@MokhlisseBadre, welcome to Stack Overflow. Don't forget to accept answers ;)
-
Mokhlisse Badre over 12 yearsproblem solved. I was able to post to page as page not as admin. I put an explaining note above. thx.
-
DMCS over 12 yearsyes, this is what I described in my answer. How to post to the page as the page. :) This question is asked about once a day on average on SO. :O
-
Krishnakant Dalal almost 12 yearsIt's worked in my case too but Where to place this code. And how to know that user already permitted this or not.
-
W00di almost 12 years@KrishnakantDalal i did not get "where to place this code" . And Facebook UI will ask the permissions to the user when he first tries to login using Facebook. And it asks only once.
-
ssaltman over 10 yearsThe key here is the "publish_stream" and "manage_pages" perms. With only "manage_pages" you'll get a bounce.