【问题标题】:Google Analytics API谷歌分析 API
【发布时间】:2015-09-09 07:01:45
【问题描述】:

我正在实施谷歌分析 Api。

授权完成没有问题。成功授权后我得到403 return code 并收到消息:User does not have sufficient permissions for this profile

我的帐户有谷歌分析数据,跟踪多个网站,我可以从网络浏览器毫无问题地访问它。我已经通过 google api 控制台允许了 Analytics api。

这是我授权成功后得到的响应:

array(2) {
  ["http_code"]=>
  int(403)
  ["error"]=>
  array(3) {
    ["errors"]=>
    array(1) {
      [0]=>
      array(3) {
        ["domain"]=>
        string(6) "global"
        ["reason"]=>
        string(23) "insufficientPermissions"
        ["message"]=>
        string(59) "User does not have sufficient permissions for this profile."
      }
    }
    ["code"]=>
    int(403)
    ["message"]=>
    string(59) "User does not have sufficient permissions for this profile."
  }
}

任何直接的帮助都将是非常可观的。谢谢

【问题讨论】:

    标签: php google-analytics google-analytics-api


    【解决方案1】:

    您用来进行身份验证的 Google 帐户 无权访问您尝试访问的 Google Analytics profile / view

    选项:

    1. 使用有权访问该个人资料的帐户登录。
    2. 授予您正在登录的用户访问该配置文件的权限
    3. 仔细检查您的个人资料 ID 是否正确 :)

    如果您使用服务帐户,请使用服务帐户电子邮件地址并将其作为 ACCOUNT 级别的用户添加到 Google Analytics(分析)帐户,就像您添加任何用户一样。

    【解决方案2】:

    当您没有授予访问权限或令牌已过期时,该错误很常见,请尝试检查这些参数。为此,您必须攻击以下范围。

    https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=xxxxxxxxxxxx

    (记住将 x 替换为您的令牌)

    {
             "azp": "1044214436568-xxxxxxxxxxx.apps.googleusercontent.com",
             "aud": "1044214436568-xxxxxxxxxxxxxx.apps.googleusercontent.com",
             "scope": "https://www.googleapis.com/auth/analytics.readonly",
             "exp": "1467026930",
             "expires_in": "3287",
             "access_type": "offline"
    }
    

    尝试使用正确的令牌命中正确的范围参数(在本例中为“https://www.googleapis.com/auth/analytics.readonly”)

    如果您需要更多帮助,请添加此信息以查看您的错误所在

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-09
      • 2018-09-13
      • 2016-05-11
      相关资源
      最近更新 更多