About Google Workspace
Google Workspace (formerly G Suite) provides email, calendar, drive and directory services for organisations. Connecting Google Workspace to Serval lets you automate common admin tasks, enforce security policies and modify user data directly inside Serval workflows.What the Google Workspace integration enables
Capability | Description |
---|---|
Access Management | Create, update, and manage users and their permissions |
Automation workflows | Manage groups, and organizational data. Create aliases, manage settings, and more |
Choose your connection method
We offer two different configuration mechanisms for Google Workspace:- Standard OAuth integration:
- Simple integration process
- Suitable for basic user and group management
- No domain-wide delegation required
- Service Account integration:
- More manual configuration required
- Full control over scopes and permissions
- Required for advanced APIs (e.g., Gmail delegation APIs)
- Enables domain-wide delegation
.png?fit=max&auto=format&n=GwC92x9foS4UfJjd&q=85&s=d8e5cea2677dd8fec6a82b280102f859)
4. Service Account Integration Setup
Step 1: Create Google Cloud Project and Service Account
- Navigate to console.cloud.google.com and login
- Create a new project:
- Click “Select Project” → “New Project”
- Choose any name for your project
.png?fit=max&auto=format&n=GwC92x9foS4UfJjd&q=85&s=e5549a6d1aaeeb77539d5a04817f2fb4)
.png?fit=max&auto=format&n=GwC92x9foS4UfJjd&q=85&s=4370a212f136af9e2c9cad71f380a6b3)
- Create a service account:
- Navigate to “Credentials” → “Create Credentials” → “Service Account”
- Name your service account and create it (other fields optional)
.png?fit=max&auto=format&n=GwC92x9foS4UfJjd&q=85&s=338efdccc4ac83d7400aff7e67b59ffd)
Step 2: Enable Required APIs
Critical: Enable the Admin SDK API in your Google Cloud project:- Navigate to “APIs & Services” → “Library”
- Search for “Admin SDK API” and “Gmail API”
- Click “Enable” for both APIs
Step 3: Configure Service Account Permissions
Grant Serval permission to impersonate your service account:- Go to your service account → “Permissions” tab → “Grant Access”
- Add principal:
serval@serval-424322.iam.gserviceaccount.com
- Assign role: “Service Account Token Creator”
.png?fit=max&auto=format&n=GwC92x9foS4UfJjd&q=85&s=ff5a433b571c2fd777e1fa3d6b9abe50)
.png?fit=max&auto=format&n=GwC92x9foS4UfJjd&q=85&s=bce91a89b2b5627879a6c2a906238a31)
Step 4: Configure Domain-Wide Delegation
-
Get your service account’s Client ID:
- Go to your service account → “Details” page
- Copy the “Client ID” (long numeric string, e.g.,
116634191637610572786
)
-
Configure in Google Workspace Admin Console:
- Navigate to admin.google.com → “Security” → “Access and data control” → “API controls” → “Manage Domain Wide Delegation”
- Click “Add New”
- Enter your service account’s Client ID
- Add these scopes:
- Click “Authorize”
.png?fit=max&auto=format&n=GwC92x9foS4UfJjd&q=85&s=aadaa61e581835afe0d7c1c13072f642)
.png?fit=max&auto=format&n=GwC92x9foS4UfJjd&q=85&s=c771cde9244b1587b214167f503810b0)
https://www.googleapis.com/auth/cloud-platform
scope is required for impersonation.
Step 5: Organization Policies (Optional)
Only complete this step if you received domain restriction errors in Step 3.- Navigate to Google Cloud Console → Organization Policies
- Search for
iam.allowedPolicyMemberDomains
- Select “Domain Restricted Sharing” → “Manage Policy”
- Select “Override Parent’s Policy” and “Merge with Parent”
- Click “Add a rule” → “Custom” → “Allow”
- Enter
C04gvbkuc
as the custom value - Save the policy
.png?fit=max&auto=format&n=1gfWe52bLpPA-o-L&q=85&s=08511478eeb82d26609d6e8af133bb27)
.png?fit=max&auto=format&n=1gfWe52bLpPA-o-L&q=85&s=c9a79280679f542ec437b6f5864d0402)
.png?fit=max&auto=format&n=1gfWe52bLpPA-o-L&q=85&s=65790d8c335b8cc405bf989a5e52c6da)
- Request access from your Organization Administrator
- Contact your Google Cloud Administrator
- Use a different Google Cloud project where you have admin rights
5. Complete Integration Setup
After completing the service account setup:- Return to Serval → “Apps” → “Available” → “Google Workspace” → “Connect”
- Enter the required information:
- Google Workspace domain: Your organization’s domain (e.g.,
company.com
) - Service Account email: Your service account’s email address
- Default subject: An admin user in your domain (e.g.,
admin@company.com
) - Scopes: The comma-separated list from Step 4
- Google Workspace domain: Your organization’s domain (e.g.,
- Click “Save”
6. Troubleshooting
Common Setup Issues
If you encounter errors during setup, verify these configurations:Component | Verification |
---|---|
APIs Enabled | Google Cloud Console → APIs & Services → Enabled APIs |
Service Account Permissions | Service Account → Permissions → Verify serval@serval-424322.iam.gserviceaccount.com has “Token Creator” role |
Domain-Wide Delegation | Google Workspace Admin Console → Security → API Controls → Verify Client ID is listed |
Error Messages and Solutions
”impersonate: status code 401: unauthorized_client”
Missing: Service account permissionsFix: Complete Step 3: Configure Service Account Permissions
”Admin SDK API has not been used in project [PROJECT_ID] before or it is disabled”
Missing: API enablementFix: Complete Step 2: Enable Required APIs
”Client is unauthorized to retrieve access tokens using this method”
Missing: Domain-wide delegationFix: Complete Step 4: Configure Domain-Wide Delegation
”Domain restricted sharing policy”
Missing: Organization policy configurationFix: Complete Step 5: Organization Policies
Getting Help
If you continue to experience issues:- Verify all steps in the setup process are complete
- Wait 10-15 minutes for Google services to propagate changes
- Check that your default subject user has admin privileges in Google Workspace