Domain-Wide Delegation in Google Workspace: How to Grant It Safely and Audit It
Domain-wide delegation in Google Workspace for admins: how it works, when to avoid it, granting minimal scopes without keys, and auditing DWD service accounts.
Last checked against Google's official documentation on .

Domain-wide delegation (DWD) is the master key of Google Workspace. It lets a Google Cloud service account act as any user in your domain, read their mail, edit their files, or change their calendar, without asking them. Backup products, migration tools, and admin automation rely on it, and it is perfectly legitimate when used carefully.
It is also the setting attackers look for first after compromising a Google Cloud project, because DWD turns access to one service account into access to the whole company. This guide explains how it works, when to avoid it, and how to grant and audit it safely, following Google’s own best practices.
Key Takeaways
- DWD lets a service account impersonate any user for the scopes you allow.
- Scopes limit what data, not which users.
- Prefer user consent, Marketplace apps, or direct access before DWD.
- Host DWD accounts in dedicated projects and never use JSON keys.
- Audit who can act as the service account, not just its scopes.
Table of contents
Open Table of contents
How Domain-Wide Delegation Works

- A developer creates a service account in a Google Cloud project.
- A super admin adds the service account’s client ID in the Admin console with a list of OAuth scopes.
- The application signs a token request saying “I am this service account, acting as user X, for these scopes.”
- Google issues an access token for user X, and the app calls Workspace APIs as that user.
There is no user consent step and no per-user limit. If Gmail read access is granted, every mailbox in the domain is readable.
When Not to Use It
Google’s best practices start with a simple question: does this app have a critical business need to bypass user consent? Often the answer is no. Consider these first:
- OAuth with user consent. Each user authorizes the app for their own data. Good for tools users choose to use.
- Marketplace apps installed by an admin. Admins can install an app domain-wide and pre-grant its scopes, with the app listed and reviewed in the Marketplace. Our Marketplace guide covers admin installs.
- Direct service account access. A service account can be given access to a specific shared drive or calendar directly, with no impersonation at all.
- Admin SDK with an admin’s consent. Many directory tasks need only an admin user’s OAuth token.
Use DWD when none of these work: full-domain backup, mailbox migration, or compliance tools that must see everyone.
Granting DWD Safely
1. Use a dedicated project
Google recommends hosting DWD service accounts in dedicated Google Cloud projects, not in a project shared with other workloads. Fewer people have access, and nothing else running there can be used to reach the service account.
2. Block keys
Do not create JSON keys for DWD service accounts. Google recommends using the signJwt API from the IAM Credentials service so the app signs assertions without a downloadable key, and enforcing organization policies that block key creation and upload. New organizations already block keys by default; see our organization policies guide.
If a vendor’s product insists on a key, put it in its own project, rotate the key on a schedule, and monitor its use.
3. Grant the narrowest scopes
In the Admin console, go to Security > Access and data control > API controls > Manage Domain Wide Delegation, click Add new, enter the client ID and full scope URLs, and click Authorize. Then open View details to confirm every scope is listed. If multi-party approval is turned on, another super admin must approve the change, and Google says changes can take up to 24 hours to apply, though usually less.
Grant only what the app uses. Some examples:
| Need | Too broad | Narrower |
|---|---|---|
| Read calendars | https://www.googleapis.com/auth/calendar | https://www.googleapis.com/auth/calendar.readonly |
| Read user directory | https://www.googleapis.com/auth/admin.directory.user | https://www.googleapis.com/auth/admin.directory.user.readonly |
| Send mail | https://mail.google.com/ | https://www.googleapis.com/auth/gmail.send |
4. Lock down the project
- Disable automatic Editor grants for default service accounts.
- Keep the number of people with Owner or Editor on the project to a minimum.
- Restrict who holds Service Account Token Creator or Service Account Key Admin on the DWD account.
Auditing DWD
Audit two things: which clients have DWD, and who can act as them.
Which clients have DWD. The Manage Domain Wide Delegation page lists every client ID and its scopes. Record the list each quarter (Google’s help page doesn’t describe an export option, so copy it into your review sheet) and confirm each one with its owner. Deleting a client stops dependent apps immediately. Delete entries for products you no longer use; they are often forgotten after a migration.
Who can act as each client. The DWD page shows the client ID, which you can map to a service account in Google Cloud. Then check its effective IAM policy with Cloud Asset Inventory, as Google suggests:
gcloud asset get-effective-iam-policy \
--scope=organizations/ORGANIZATION_ID \
--names=//iam.googleapis.com/projects/PROJECT_ID/serviceAccounts/SA_ID
Look for Service Account Token Creator, Service Account Key Admin, Owner, and Editor at the project, folder, and organization levels. Any of them can let a person or another service account act as the DWD account.
Also watch for lateral movement, where a service account in another project can impersonate this one. Google’s lateral movement insights in the IAM recommender highlight these paths.
Monitoring
- In the Admin console, alert on changes to domain-wide delegation in the admin audit log. Our audit logs guide shows where admin events live.
- In Cloud Logging, alert on key creation and on
signJwtor token calls from unexpected sources for DWD service accounts.
A Quarterly DWD Review
- Record the DWD client list and scopes.
- Map each client ID to a service account, project, vendor, and business owner.
- Remove clients with no owner or no current use.
- Narrow scopes that are broader than the product needs.
- Check effective IAM on each service account and project.
- Confirm no JSON keys exist, or that existing ones are rotated.
Worked Example: A Backup Tool
Suppose your company adopts a third-party backup product for Gmail and Drive. A safe setup looks like this:
- Decide where the service account lives. If the vendor hosts it, they give you a client ID; skip to step 4. If you host it, create a dedicated project such as
acme-backup-dwdin your Shared services folder. - Create the service account with no IAM roles on the project beyond what the vendor documents.
- Avoid keys. If the product supports keyless signing, configure it. If it requires a key, keep that project isolated and set a rotation reminder.
- Add the client ID in the Admin console under Manage Domain Wide Delegation, with only the scopes the vendor lists for the features you use. If you do not back up Calendar, do not grant Calendar scopes.
- Restrict the project. Only two named admins hold Owner, and nobody else has Token Creator.
- Record ownership. Note the vendor, contract owner, scopes, and review date.
- Test and monitor. Run a backup, confirm it works, and set alerts for DWD changes and key events.
When the contract ends, remove the client ID first, then delete the service account and project.
Questions Admins Often Ask
“Is the client ID the same as the service account email?” No. DWD uses the service account’s numeric unique ID, also called the OAuth client ID. You can find it in the Cloud console under IAM & Admin > Service accounts, in the account’s Advanced settings. You can edit a client’s scopes later, but not its client ID.
“Can I limit DWD to one organizational unit?” Not through scopes. DWD applies to the whole domain for the scopes granted. If an app should only touch some users, prefer an approach based on user consent or a vendor feature that limits processing.
“Who can see the DWD list?” Only super admins can manage it, which is one more reason to protect those accounts as described in our super admin and Organization Administrator guide. Treat changes to it as high-severity events.
Detecting DWD Misuse
Because DWD bypasses consent, misuse looks like normal API activity from users’ accounts. A few signals help:
- New DWD entries in the admin audit log, especially outside change windows.
- Scope changes on existing entries, such as a backup tool suddenly gaining Gmail send access.
- Token activity from unexpected places, such as a DWD service account being used from an IP range the vendor does not publish.
- Unusual volume, such as a tool that normally reads a few hundred mailboxes a night touching every account in an hour.
- Key creation on a DWD service account, which should never happen if keys are blocked.
Feed these into the same alerting you use for other admin events. Our Workspace logs to BigQuery guide shows how to keep the admin and OAuth events long enough to investigate.
Conclusion
Domain-wide delegation is safe when it is rare, narrow, and watched. Keep the list short, the scopes tight, the projects dedicated, and the keys out of the picture. Then audit who can act as each account, because that is where the real risk sits.
If you rely on backup or migration tools for Google Workspace, review their DWD entries today. Tomorrow’s guide covers service accounts in general and how Workload Identity Federation removes the need for keys.
Official Google documentation:
Related reading:
- Google Workspace Backup: Third-Party Solutions: tools that use DWD.
- Apps Script and Google Cloud Projects: consent-based access first.
- Migrating to Google Workspace from Microsoft 365: migration tools and their access.
This guide contains referral or affiliate links. If you sign up through one, Workspace Blog may earn a commission at no extra cost to you. Read our referral and advertising disclosure.
Frequently Asked Questions
- What is domain-wide delegation in Google Workspace?
- Domain-wide delegation lets a Google Cloud service account act as any user in your Workspace domain for the OAuth scopes you allow, without each user's consent. It is used by backup tools, migration tools, and admin automation that must reach every mailbox or Drive.
- Where do I configure domain-wide delegation?
- In the Admin console under Security > Access and data control > API controls > Manage Domain Wide Delegation. You add the service account's client ID and the exact OAuth scopes it may use. Only super admins can manage it.
- Do scopes limit which users a DWD service account can impersonate?
- No. Google's best practices note that scopes limit the type of data the service account can access, but not which users it can impersonate. A DWD client with Gmail read access can read every user's mail, which is why scopes must be as narrow as possible.
- Should DWD service accounts use JSON keys?
- Google recommends against it. Use the IAM Credentials signJwt API to sign assertions without a downloadable key, and use organization policies to block key creation and upload for DWD service accounts.
- How do I find who can use a DWD service account?
- Use Cloud Asset Inventory to get the effective IAM policy on the service account and its project. Look for roles such as Service Account Token Creator, Service Account Key Admin, Owner, and Editor, which give direct or inherited ability to act as the account.