0

Hope it's not a very noobish question i'm asking :) -

I'm trying to set the score parameter for my app ( Game category app ) with the AS3 Flash API ( Which i see is a wrapper around JS Api ) but i keep getting the "(#15) This method must be called with an app access_token" error, i've also tried a test call with the Graph API Explorer and the result is the same.( with generated acces token of the app and copy/pasted acces token )

I've searched the permission tables and i've set both publish_actions and user_games_activity for the authentification process.

Getting works perfectly ( i can receive basic information without any problems also score information but it's just an empty array probably because it isn't set ) posting seems to be the culprit

I want to know if i'm doing something wrong ( something like there's an additional auth process necessary on my server side )

If you guys have any ideea please help this is becoming very frustrating

Thanks in advance :D

1 Answers1

2

Finally found the solution.

Here is the correct AS3 code:

var data:Object = new Object();
data.score = 285;
data.access_token = APP_ACCESS_TOKEN;
var requestType:String = "POST";
Facebook.api( Facebook.getAuthResponse().uid +  "/scores/" , handlePostScoreComplete, data, requestType);

You MUST get the app access token using PHP or some other client-side SDK, not the Javascript SDK because it needs the app secret.

So in PHP you must get the access token and then you can pass it to Flash:

<?php

$APPLICATION_ID = YOUR_APP_ID;
$APPLICATION_SECRET = YOUR_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);

?>