19
votes

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?

3
You should change your app secret immediately - anyone who copied it before I edited your question can change your app's settingsIgy
still visible in revision history.SachinGutte
the bounty is for @sumitkanoje, I searched like 3 (nightly) hours to get to this and it deserves a good ol reputation boost :-DBamboomy

3 Answers

29
votes

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.

8
votes

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!! :)

-1
votes

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