0

I am using the GoViral ANE for integrating with Facebook, specifically creating a leaderboard to display in my game.

I would like to highlight the current user's score, but I don't appear to have access to the id that is returned via the APP_ID/scores request.

For example, data is returned in the following format:

{"score":123,"user":{"name":"Colin","id":"1234"}}

The id portion is what I am looking to match to the current user to highlight the score.

I have tried GoViral.goViral.getFbAccessToken() but this is clearly the wrong thing. I have also tried making a call out to get the current user's score, but it also requires a User Id to make the call, so I am a little stumped on this one.

Searching on Google doesn't seem to return any useful results either.

Thank you for your time.

1 Answers1

0

Ah, it seems I don't need a user id to make the call after all.

The call I was attempting was the following:

From the Facebook developer site:

You can read the score for a person playing your game by issuing a HTTP GET request to /USER_ID/scores with a user access_token.

With this code:

GoViral.goViral.facebookGraphRequest(
  GoViral.goViral.getFbAccessToken() + "/scores",
  GVHttpMethod.GET);

However the following call works:

GoViral.goViral.facebookGraphRequest(
  "me/scores",
  GVHttpMethod.GET);

So using "me" works instead of the user id, which returns:

{"score":123,"user":{"name":"Colin","id":"1234"}}

Allowing me to access the user id.