I created a rank of users (players) of my game, and then I would like to show the top ones (just the names and score) in a list.
I've tried to do this:
$unam开发者_JAVA技巧e = $facebook->api("/{$score->uid}?fields=name");
That works perfectly to the first user, but the other ones receive an error message:
Fatal error: Uncaught OAuthException: Error validating application. thrown in /.../mygame/facebook/base_facebook.php on line 1028
What else can I do to retrieve the current user name?
Read Score requires a user access_token, you may need to request offline_access or save each users access_token to your database and make your call to each user using each individual token.
http://developers.facebook.com/docs/reference/api/application/#scores
If you save the access_token with out offline_access you will have to update the token in your database from time to time or when a user logs in.
精彩评论