3-1. Service Account
Follow these steps only if you use the service account method.
Step 1: Service Account and Key
-
Enter 'IAM' in the Google Cloud console search bar and click IAM & Admin.
-
Click Service Accounts > Create service account.
-
Enter a name (e.g.,
logpresso) and click Create and close. -
Click the email of the new service account to open its details page.
-
Click Keys > Add key > Create new key.
-
Select JSON as the key type and click Create. The key file is downloaded automatically. Store it in a safe place.
Step 2: Domain-wide Delegation
-
On the service account details page, copy the Client ID under Details > Advanced settings, and click VIEW GOOGLE WORKSPACE ADMIN CONSOLE.
-
In the Admin console, go to Security > Access and data control > API controls and click Manage Domain Wide Delegation.
-
Click Add new, enter the client ID and OAuth scopes, and click Authorize. Enter only the scopes for the features you will use from 1. Required Permissions, separated by commas.
To use all features, paste the following string as-is.
https://www.googleapis.com/auth/admin.reports.audit.readonly,https://www.googleapis.com/auth/drive.apps.readonly,https://www.googleapis.com/auth/apps.alerts,https://www.googleapis.com/auth/admin.directory.domain.readonly,https://www.googleapis.com/auth/admin.directory.user.readonly,https://www.googleapis.com/auth/admin.directory.group.readonly,https://www.googleapis.com/auth/spreadsheets.readonly,https://www.googleapis.com/auth/spreadsheets
| App version | Scopes to register |
|---|---|
| 1.9.2610.0 or later | Only the scopes for the features you use (the string above is the 8 scopes for all features) |
| Earlier than 1.9.2610.0 | The app requests all scopes at once, so register all 9 below. If any one is missing, no feature works: admin.reports.audit.readonly, drive.apps.readonly, apps.alerts, admin.directory.domain.readonly, admin.directory.user.readonly, admin.directory.group.readonly, spreadsheets, drive.activity.readonly, contacts.readonly |
- Scope names in domain-wide delegation must match exactly. For example, registering
spreadsheetsdoes not count as registeringspreadsheets.readonly. - To reduce previously registered scopes, upgrade the app to 1.9.2610.0 or later first. Reducing them before upgrading stops all collectors and query commands.
- Domain-wide delegation lets the service account access the registered scopes on behalf of every user in the organization. Do not register scopes for features you do not use, and keep the key file secure.








