使用getCount时"需要指定有效用户..."错误

Joh*_*ar. 3 facebook facebook-graph-api

我正试图getCount测试控制台使用.

当我输入uid已安装我的应用程序的用户(使用基本和publish_stream权限)时,我收到以下错误:

{
  "error_code": 240,
  "error_msg": "Requires a valid user is specified (either via the session or via the API parameter for specifying the user.",
  "request_args": [
    {
      "key": "uid",
      "value": "REMOVED_USER_ID"
    },
    {
      "key": "method",
      "value": "dashboard.getCount"
    },
    {
      "key": "access_token",
      "value": "REMOVED_ACCESS_TOKEN"
    },
    {
      "key": "format",
      "value": "json"
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

任何想法为什么会发生这种情况?我该如何解决?我需要一些额外的权限吗?

squ*_*lan 8

约翰,你不需要额外的权限.问题出在您的访问令牌上.该工具使用的访问令牌是您的个人用户访问令牌,仅适用于您的uid.如果您使用应用程序访问令牌(意味着APP_ID | APP_SECRET),那么您将能够为应用程序的所有用户查看此方法的结果.

api.facebook.com/method/dashboard.getCount?uid= [UID]&access_token = [appid | appsecret]&format = json