Facebook Graph API Explorer 不会发布分数

发布于 2024-12-06 09:38:56 字数 658 浏览 1 评论 0原文

根据Facebook文档:

“为用户创建或更新分数

只要您拥有publish_actions权限,您就可以通过使用应用程序access_token向/USER_ID/scores发出HTTP POST请求来发布分数或用户。”

因此,我从访问令牌工具获取应用程序访问令牌。我还验证了publish_actions权限已启用。

当我使用 API Explorer for /USER_ID/scores 和应用程序访问令牌时,出现以下错误:

{
  "error": {
    "message": "A user access token is required to request this resource.", 
    "type": "OAuthException"
  }
}

好的。因此,我提供了用户访问令牌,然后我得到:

{
  "error": {
    "message": "(#15) This method must be called with an app access_token.", 
    "type": "OAuthException"
  }
}

我在这里做错了什么?

编辑:只要身份验证设置为 WEB 而不是移动/本机,它就可以工作。

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.", 
    "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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

说不完的你爱 2024-12-13 09:38:56

您需要使用应用程序令牌发布分数。由于您正在使用应用程序令牌,因此您不能再使用 /me,因此您需要发布到 /userid/scores。如果您的应用程序令牌不起作用,请暂时尝试以下格式:appID|appSecret

您需要首先确保用户已授予publish_actions(通过调用/userid/permissions进行验证)。您还需要确保您的应用程序被标记为游戏。

我只是通过 Facebook Graph Explorer 自己完成了这一切,它起作用了:
在此处输入图像描述

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:
enter image description here

晨曦÷微暖 2024-12-13 09:38:56

如果您在开放图谱中构建了自己的操作类型,则应在操作配置页面中的“需要应用令牌才能发布”处选择“否”。它解决了我的问题“(#15)必须使用应用程序 access_token 调用此方法。”

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."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文