Grant Service Account API Access
- Log into Google Admin with the same Google account.
- Go to Security > API Controls, scroll down and click Manage Domain wide Delegation.
- Click Add new to authorize the registered client to access your user data.
- In the Client ID field, enter the Client ID saved from Configure Service Account. Your Client ID must be a string of numbers.
- In the OAuth scopes field, enter:
"https://www.googleapis.com/auth/admin.directory.user,https://www.googleapis.com/auth/admin.reports.audit.readonly".
After getting your service account ID and JSON private key, grant the service account with Owner and Organization Administrator role for the projects to be monitored.