I'm trying to access scores through the Facebook API to get a list of scores of my friends. When I try to access /[facebook id]/scores
, I get the following error even with my app access token:
FacebookApiException [ 0 ]: A user access token is required to request this resource. ~ APPPATH/classes/basefacebook.php [ 1039 ]
How do I get a user access token?
Updated: After reading http://developers.facebook.com/docs/reference/api/permissions/, I've confirmed that the app access token and user access token are two different access tokens. The question still remains, how do I get a user access token?
I see that you are using the php-sdk. So you need your friend to access your app with a script something like the example:
Then you need to:
offline_access
permissionaccess_token
$facebook->api('friend_id/scores?access_token=$stored_access_token');
In Flex you can use:
Please refer to the documentations showing the authentication flows for Facebook.
http://developers.facebook.com/docs/authentication/
This is the best place to start to understand how it works.
The access_token is not to be mistaken for your application secret code, which is used to authorised to make a connection on behalf of your registered application.
I call this function:
Which calls the function below and gets the accesss_token from the response.
Suscribe to this event:
then check response.status