According to Facebook documentation:
"Create or update a score for a user
You can post a score or a user by issuing an HTTP POST request to /USER_ID/scores with the app access_token as long as you have the publish_actions permission."
So I obtain the app access token from the access token tool. I have also verified that the publish_actions permission is enabled.
When I use the API Explorer for /USER_ID/scores with app access token I get the following error:
{
"error": {
"message": "A user access token is required to request this resource."开发者_JAVA百科,
"type": "OAuthException"
}
}
OK. So I provide the user access token instead and I get:
{
"error": {
"message": "(#15) This method must be called with an app access_token.",
"type": "OAuthException"
}
}
What am I doing wrong here?
EDIT: It works as long as authentication is set to WEB instead of Mobile/Native.
You need to POST the score using the application token. Since you are using the application token, you can no longer use /me so you will need to post to /userid/scores. If your application token isn't working, try one in this format temporarily: appID|appSecret
You need to first make sure the user has granted publish_actions (verify by calling /userid/permissions). You also need to make sure you application is marked as a game.
I just did this all myself via the Facebook Graph Explorer and it worked:
If you have built your own Action-Type in the Open-Graph then you should select "no" at "Requires App Token to Publish" in the Action configuration page. It fixed my issue with "(#15) This method must be called with an app access_token."
精彩评论