Subok Tao
Subok Tao

Reputation: 191

This method must be called with an app access_token

After days of searching the forums/net, I still couldn't get this to go away and use the SCORE graph api

{
  "error": {
  "message": "(#15) This method must be called with an app access_token.", 
  "type": "OAuthException", 
  "code": 15
  }
}

On the graph api explorer i tried using this (with publish_actions permission activated & POST selected):

https://graph.facebook.com/100003429183160/scores?score=555&access_token=APP_ACCESS_TOKEN

Having no luck :(

I have done the following:

• Set my app as a GAME, the basic info, setup the Auth Dialog

• Setup the Open Graph type, object, aggregation

• Use/Verify the right APP ACCESS_TOKEN (not the user access_token) via Access Token Tool

• Use the publish_actions permission

• Made sure it's using POST as method

• Tried appID|appSecret as an app access_token

• Verified that I indeed installed the app

• Was able to post to a wall via graph api, pull friends list and photos, etc.

Any clues what else could cause this not to run with the Graph API Explorer?

Upvotes: 19

Views: 26012

Answers (3)

raman rayat
raman rayat

Reputation: 414

Go to your setting => Basic => App Secret and use that key for secret key then it will generate access token which you can use in your app, hope it will work

Upvotes: -1

abhi
abhi

Reputation: 1444

Read this link.

There is an alternative way:
You can provide App_Id and App_Secret instead of App_Access_Token.

So try this:

https://graph.facebook.com/100003429183160/scores?score=555&access_token=APP_ID|APP_SECRET

Hope it helps!! :)

Upvotes: 10

sumitkanoje
sumitkanoje

Reputation: 1245

Answer:-

Actually for using SCORE Graph API you need the "Application access token" which is different than a normal access token

So if you want your task to be done GET an Application access token by using the following script.......

And then replace the generated application_access_token with old access_token, that's it

$APPLICATION_ID = "APP_ID";
$APPLICATION_SECRET = "APP_SECRET";

$token_url =    "https://graph.facebook.com/oauth/access_token?" .
                "client_id=" . $APPLICATION_ID .
                "&client_secret=" . $APPLICATION_SECRET .
                "&grant_type=client_credentials";
$app_token = file_get_contents($token_url);

After getting this application access token you can easily do this task.

When You Need An Application Access Token

You need to use a Facebook application access token when you have a process that acts on behalf of the application, rather than on behalf of a particular user. This happens when you access your Facebook Insights data for your app via the graph, and also when you want to create test Facebook users for your app.

Sadly, the documentation for this is buried in the authentication guide for the Facebook graph API.

Upvotes: 32

Related Questions