Facebook Application Auth Token Get Error

2019-06-02 05:24发布

问题:

I am trying to request the authtoken for my app via the Facebook API Graph Exlorer following the facebooks instructions. When I do a get call with a URL with the following form:

https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials

I get the following error:

 {
  "error": {
    "message": "Invalid callback",
    "type": "OAuthException",
    "code": 1
  }
}

Suggestions on how I might go about obtaining the access token for my app would be greatly appreciated!

If I try to obtain the access code programmatically running the following code:

 FB.api('/oauth/access_token?client_id={APP_ID}&client_secret={APP_SECRET}&grant_type=client_credentials', function(response) {
   alert(JSON.stringify(response));
  });

I get the following error:

{"error":"load-error: unknown"}

回答1:

You cannot execute this command using the Facebook Graph API explorer. Typing it directly into the browser returns the access token as desired.