I am using a serverless Python function for retrieving G Suite logs. I have done the following to authenticate against Admin SDK:
1) Created a project
2) Created a service account with the Project->Owner role
3) Create a private key (JSON) file
4) Enabled domain-wide delegation
5) Enabled the Admin SDK
6) Delegate domain-wide authority via 'One or More API Scopes' by authorizing my service account with https://www.googleapis.com/auth/admin.reports.audit.readonly
Now, when running my authorized application I use 1) the username (privileged user's email address) with access to the created service account and 2) the private key (JSON) file for the service account.
When authorizing my application, I use ServiceAccountCredentials
from the oauth2client.service_account
package.
The Question:
When running my application, I can't authorize against G Suite unless I use the username (email address) of a privileged user. When I substitute this email address for the service account's email address, I can't retrieve G Suite logs.
Is it possible to configure the service account to allow authorization via the service account email address? If so, how can I do that?