COLLABORATION & MESSAGING
Service account + domain-wide delegation
To connect Dex to your Google Workspace environment, you need to configure a Google Cloud service account with domain-wide delegation.
Steps
- Go to the Google Cloud Console and create a new project or select an existing one.
- Navigate to APIs & Services > Library, search for Admin SDK API, and click Enable.
- Go to IAM & Admin > Service Accounts and click Create Service Account; give it a name (e.g., dex-management-sa), click Create and Continue, skip optional permissions, and click Done.
- Select the service account, go to the Keys tab, click Add Key > Create new key, select JSON, and download the key file.
- Open the JSON key file. You will need the client_email (Service Account Email), the private_key (Private Key PEM), and the client_id.
- Open the Google Workspace Admin Console and go to Security > Access and data control > API controls.
- Under Domain-wide delegation, click Manage Domain-Wide Delegation, then click Add new.
- In the Client ID field, paste the client_id (numeric string) from the JSON key file.
- In the OAuth scopes field, paste this comma-separated list, then click Authorize: https://www.googleapis.com/auth/admin.directory.user, https://www.googleapis.com/auth/admin.directory.group, https://www.googleapis.com/auth/admin.directory.orgunit, https://www.googleapis.com/auth/admin.directory.device.mobile, https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly, https://www.googleapis.com/auth/admin.directory.resource.calendar
Paste into Dex
The connection form in the Dex app store asks for these values:
-
Service Account Email The client_email from the JSON key file.
-
Private Key (PEM) The private_key from the JSON key file.
Links on page: Open Google Workspace console, Official docs.