【问题标题】:Google Reports API with a service account带有服务帐户的 Google Reports API
【发布时间】:2015-10-16 15:15:09
【问题描述】:

我正在尝试使用服务帐户调用 Google Reports API。

我遵循这个代码示例:https://godoc.org/golang.org/x/oauth2/google#JWTConfigFromJSON

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "authError",
    "message": "Access denied. You are not authorized to read activity records."
,
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Access denied. You are not authorized to read activity records."
 }
}

我很确定它在 Google 配置方面,但是:

  • 我创建了服务帐号
  • 我下载了 JWT
  • 我授权了所需的范围

然后我尝试调用这个 URL:https://www.googleapis.com/admin/reports/v1/activity/users/all/applications/login

我会忘记什么?

谢谢你帮助我。

【问题讨论】:

    标签: go google-api


    【解决方案1】:

    修复它。需要明确指定主题值。 我现在遵循服务帐户示例:https://godoc.org/golang.org/x/oauth2/google

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-03-18
      • 2015-08-26
      • 1970-01-01
      • 1970-01-01
      • 2016-12-19
      • 2021-11-17
      • 2012-11-24
      相关资源
      最近更新 更多