Facebook API returns permission error despite access token being valid

Viewed 29

I'm using facebook's API to post on a facebook page, and this the error that comes up.

{
  error: {
    message: '(#200) If posting to a group, requires app being installed in the group, and \\\n' +
      '          either publish_to_groups permission with user token, or both pages_read_engagement \\\n' +
      '          and pages_manage_posts permission with page token; If posting to a page, \\\n' +
      '          requires both pages_read_engagement and pages_manage_posts as an admin with \\\n' +
      '          sufficient administrative permission',
    type: 'OAuthException',
    code: 200,
    fbtrace_id: 'AcWINdvgXkS1Apmj4h4LEDZ'
  }
}

The message there is incorrect, as I used the token debugger to find out the following.

enter image description here

All required permissions seem to be there, and it is indeed a page type token.

The code is very simple.

enter image description here

I have a feeling this is another case of facebook's terrible error messaging. Any ideas?

1 Answers

Oh god! After hours of debugging - the issue was that I was using a hashtag in the message, which obviously cut off the URL, making the access_token invisible.

Solution - encodeURIComponent(random_tag)

Silly mistake!

Related