带有服务帐户的Google Reports API

问题描述:

我正尝试使用服务帐户拨打Google Reports API。带有服务帐户的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." 
} 
} 

我敢肯定它是在谷歌配置的一面,但:

  • 我创建的服务帐户
  • 我下载了智威汤逊
  • 我授权所需的示波器

然后我尝试打电话给这个URL:https://www.googleapis.com/admin/reports/v1/activity/users/all/applications/login

我能忘记什么?

谢谢你帮助我。

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