0

I am developping my first facebook social game in PHP and I follow the social game tutorial provided on developer.facebook.com

My game is on a server and loaded into a canvas page.

Everything is clear but I can't resolve a problem when I try to deal with achievements: http://developers.facebook.com/docs/guides/games/getting-started/#step6

I was able to create, register and save achievements but I get an error when I try to consult the achievements my user had already earned. The code is this one:

function getAchievements() {
    FB.api('/me/achievements', function(response) {
        for(var i = 0; i < response.data.length; i++) {
            ...
        }
    ...
});

In my console, if I trace the response object, I see there is an authentication error:

response : {
    "error": {
        "message": "An active access token must be used to query information about the current user.",
        "type": "OAuthException",
        "code": 2500
    }
}

I've tried a lot of things but I can't resolve this problem. The user is logged, I've asked for email,publish_actions permissions, I've tried to add the user_games_activity extended permission... :(

Does someone know what is going on with this particular FB.api call?

Julien Le Thuaut
  • 415
  • 1
  • 6
  • 17
  • 1
    The permission is called `user_games_activity`. If you have requested that, check your access token using the debug tool, if it really shows up there. – CBroe Nov 09 '12 at 17:05
  • Hi CBroe, so my PHP code declares `$scope = 'email,publish_actions,user_games_activity';` and my app User & Friend Permissions are the same. When I go to the "access token tool", if I choose to debug my user access token, the values i see are the same too. So I wonder why my FB.api call doesn't work... I think an old token must be saved somewhere (cookie?) but I don't understand how this API work :( – Julien Le Thuaut Nov 12 '12 at 17:45
  • So there's no need to ask for the `user_games_activity` extended permission to read achievements for a user. My problem seems to be a JS API bug :( – Julien Le Thuaut Nov 15 '12 at 11:50

0 Answers0