as listed in the documentation.
What could I be missing here to open up authorization to use Admin SDK APIs?
Solved! Go to Solution.
I found the root issue. In order to use the Admin SDK API, the service account must impersonate an administrator of the domain. Domain-wide delegation is not enough to interacted with Admin SDK API.
To implement this, you must include the email address of an admin of your domain in the JWT subject, in addition to audience, issuer, and scope. (JSON Claims Set in a JSON Web Token (JWT))
Endpoint:
https://admin.googleapis.com/admin/directory/v1
Issuer:
Google Service account:
xxx@xxx.iam.gserviceaccount.com
Audience Claim:
https://www.googleapis.com/oauth2/v4/token
Subject:
Domain administrator email address
Obviously provide the correct certificate/key produced for service account authorization as well.
NOTE: No additional permissions are required to be added to the service account in the GCP console. Simply enable the API. In my case I set the service account role to owner.