Ad

Facebook Graph API - I Recieve The Error "Missing Authorization Code"?

- 1 answer

i am new to the facebook api and i came across a weird issue and i cannot really find a solution for it. i am trying to get an access token using the following instructions :

enter image description here

but when i try to do :

curl -X GET "https://graph.facebook.com/oauth/access_token?client_id=[ID]&client_secret=[SECRET]&redirect_uri=http://localhost&grant-type=clients_credentials"

it fails even when i do it in my code , it also fails:

    var firstOptions = {
    method: 'GET',
    url: 'https://graph.facebook.com/oauth/access_token?client_id=[ID]&client_secret=[SECRET]&grant-type=client_credentials&redirect_uri=http://localhost',
    json: true,

  };
  request(firstOptions, function (error, response, body) {
    console.log(body);
  });

so i was wondering if someone could tell me where and how i get the authorization code ? or if i am doing something wrong. because the facebook image isn't including any authorization code..

EDIT:

after a suggestion i tried the following :

    var pageOptions={
    method: 'GET',
    url: 'https://graph.facebook.com/[PAGE-ID]/posts?access_token=' + 'ID|SECRET',
    json:true
  };

but then i got the follow error:

{ message: '(#10) To use \'Page Public Content Access\', your use of this endpoint must be reviewed and approved by Facebook. To submit this \'Page Public Content Access\' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.',

this error does not occure when i use an access_token generated by the Access Token Debugger:

https://developers.facebook.com/tools/debug/accesstoken/

Ad

Answer

{ message: '(#10) To use \'Page Public Content Access\', your use of this endpoint must be reviewed and approved by Facebook. To submit this \'Page Public Content Access\' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.',

this error does not occure when i use an access_token generated by the Access Token Debugger

You are simply using the wrong kind of access token here.

To access content of just any arbitrary public page, your app would need to be reviewed by Facebook first.

It works with the token you generated in the debug tool, because that is a user token and you have an admin role on the page in question - which means this is not general access to just “public” data any more, but to content you actually have admin access to. With an app access token, the API has no way of checking for that.

You need to use a page admin user token, or a page token for this kind of request.

Ad
source: stackoverflow.com
Ad