Facebook permissions error 200
-
26-12-2019 - |
Question
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
Solution
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.
OTHER TIPS
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
When publishing to PAGES not USERS. Three things that may trip you up....
You will need: pages_show_list, manage_pages, publish_pages permissions in the developers console: https://developers.facebook.com/apps
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)))
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 ).
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.