Q:

Google Reports API with a service account

I'm trying to make a call to Google Reports API with a service account.
I follow this code example : 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."
 }
}

I'm pretty sure it is on Google configuration side but :

I created the service account
I downloaded the JWT
I authorized the needed scopes

Then I try to call this URL : https://www.googleapis.com/admin/reports/v1/activity/users/all/applications/login
What could I have forget ?
Thanks for helping me.

A:

Fixed it. Needed to explicitly specify the subject value.
I now follow the Service Account example : https://godoc.org/golang.org/x/oauth2/google

