3

We've created an app which has the following permissions:

"App Info": is live "Status and review page": is live

It has the following permissions:

  • App Details - English (UK)

  • email

  • manage_pages

  • public_profile

  • publish_actions

  • user_friends

Again all approved.

So why could it possibly be that the app reports errors and returns the following error: "(#200) Permissions error".

We cannot see for the life of us what we could possibly be missing. This is a v2 app which has been created in the last month.

Thanks

Antony

Ukuser32
  • 2,147
  • 2
  • 22
  • 32
  • Can you give us an example where you would get this error? – Jimmy Knoot Aug 01 '14 at 08:26
  • You got me thinking (unfortunately still unresolved). We initially were posting an image + message to me/photos so I wondered if the user_photos permission is required (even though the documentation didn't say so) but I've tried without and it still fails. $params = array( 'access_token' => $this->facebook->getAccessToken(), 'message' => $message ); $updateID = $this->facebook->api('/me/feed','POST',$params); I hope that helps and sorry for the updates - kept hitting return instead of shift + return! – Ukuser32 Aug 01 '14 at 08:47
  • 2
    Only the publish_actions permission is needed, as the docs states. I can only guess that your access_token does not have the required permissions, you can check this by dumping your access_token and put it through the debug tool: https://developers.facebook.com/tools/debug/ – Jimmy Knoot Aug 01 '14 at 09:12
  • WOW! I didn't know about that tool. Thank you. It now shows: Issued 1406799047 (23 hours ago) Expires Never Valid True Origin Web Scopes public_profile, manage_pages Which shows where the problem lies. However this account was re-added this morning and the app does have these permissions! So moving forward but slowly! – Ukuser32 Aug 01 '14 at 09:21
  • So the access_token you are using does not have the permissions you mention in your question, if you added the permissions later, you should remove the permissions you have given and re-ask them. You can remove permissions at Settings > Apps > – Jimmy Knoot Aug 01 '14 at 09:22
  • Sorry to clarify - is that Settings > Apps as the developer or as the front end user. How would you then readd them? As the user this morning was added after all the permissions were setup. – Ukuser32 Aug 01 '14 at 09:34
  • Is the user an account that you own and can control on Facebook? If so it is on https://www.facebook.com/settings?tab=applications, else you can remove the permissions via an API call. – Jimmy Knoot Aug 01 '14 at 09:44
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58483/discussion-between-jimmy-knoot-and-ukuser32). – Jimmy Knoot Aug 01 '14 at 11:07

3 Answers3

2

Ok - I cannot claim credit for this one it was a colleague but the issue was that the old SDK was calling getLoginUrl. This function has the FB permissions as part of the call which have changed - we had publish_stream, but now we need publish_actions. Thanks for all help and I hope someone finds this useful.

Ukuser32
  • 2,147
  • 2
  • 22
  • 32
1

If you get permissions errors, the user has not given your application permissions to do an action. Do note that users can reject any permission except for basic profile for any v2 application.

You can test all URLs, Access Tokens, or Open Graph Action IDs with the Facebook Debugger: https://developers.facebook.com/tools/debug

If you input your access token here you can see what permissions are given by a user. You can also call /me/permissions to see what permissions are given by a user, you can find the documentation about this here: https://developers.facebook.com/docs/graph-api/reference/v2.0/user/permissions

Jimmy Knoot
  • 2,378
  • 20
  • 29
  • I have now removed the App from Facebook (having removed the app first), re-added it through our system and then checked the token and it still just says profile and pages! Really confused why its not working. – Ukuser32 Aug 01 '14 at 09:54
  • Did you set the right app id and app secret in your Facebook configuration? – Jimmy Knoot Aug 01 '14 at 10:04
  • Yep 100% ok? Wierd isn't it! – Ukuser32 Aug 01 '14 at 10:46
  • Sorry for late reply - same settings unfortunately: - installed: granted - public_profile: granted - manage_pages: granted – Ukuser32 Aug 01 '14 at 14:56
0

When publishing to PAGES not USERS. Three things that may trip you up....

  1. You will need: pages_show_list, manage_pages, publish_pages permissions in the developers console: https://developers.facebook.com/apps

  2. You will need to define the scope when doing oauth as:

    args = { 'redirect_uri':'http://www.yourdomain.com/facebook/callback/', 'client_id':settings.FACEBOOK_ID, 'scope':'public_profile,pages_show_list,manage_pages,publish_pages', } return HttpResponseRedirect("%s?%s" % ('https://www.facebook.com/dialog/oauth', urllib.urlencode(args)))

  3. You will need to use the PAGE ACCESS TOKEN, not the USER ACCESS TOKEN. To get the PAGE ACCESS TOKEN, you will need to call:

https://graph.facebook.com/me/accounts/?

Which will return name, id, and access token ( this is the page one ).

  1. Then do the post using the PAGE ACCESS TOKEN:

    args = { 'access_token':self.facebook_page_token } if message: args['message'] = message if link: args['link'] = link if name: args['name'] = name if picture: args['picture'] = picture if caption: args['caption'] = caption if place: args['place'] = place response = json.loads(urllib.urlopen("https://graph.facebook.com/%s/feed/" % self.facebook_page_id, urllib.urlencode(args)).read())

That's it good to go. You DO NOT NEED publish_actions for page posting.

Paul Kenjora
  • 1,914
  • 18
  • 20