Domain-Wide Delegation
This guide details how to authorize your Service Account to access Google Workspace data by setting up Domain-Wide Delegation (DwD). This process allows the service account to "impersonate" your Admin Email to read users, groups, and devices.
π Prerequisites
Before starting, ensure you have:
The Client ID: This is the numeric ID of your Service Account (found in the JSON key file or the GCP Console under IAM > Service Accounts).
Super Admin Access: You must be a Super Admin in the Google Admin Console.

Step 1: Navigate to API Controls
Log in to the Google Admin Console.
In the left-hand menu, navigate to Security > Access and data control > API controls.
Scroll down to the Domain-wide delegation section at the bottom.
Click MANAGE DOMAIN WIDE DELEGATION.
Step 2: Register the API Client

On the Domain-wide Delegation page, click the Add new button next to the "API clients" list.
A dialog box will appear. Enter the following information:
Client ID: Paste the numeric Client ID for your Service Account.
OAuth Scopes: Copy and paste the following comma-separated list into the field:

Plaintext
Click Authorize.
π Authorized Scopes Reference
Once authorized, your Service Account will be able to perform the following functions:
Scope
Application Service
Purpose
admin.directory.user.readonly
GCPUserClientService
Read-only access to user profiles and metadata.
admin.directory.group.readonly
GCPGroupClientService
List organization groups and view their memberships.
cloud-identity.devices.readonly
GCPDeviceClientService
View and inventory managed devices in the organization.
admin.directory.customer.readonly
Core Service
Read organization-level configuration and customer data.
β
Verification
Check the list of API Clients to ensure your Client ID appears with the correct scopes.
Return to your application's GCP Configuration page.
Enter the Admin Email (the person being impersonated) and click Test.
If the test passes, the Service Account is successfully authorized to "act as" the admin for these specific read-only tasks.
Domain-Wide Delegation is extremely powerful. Ensure that only the minimum required scopes (listed above) are granted to keep your environment secure.
Last updated
Was this helpful?