Adding a Google Service Account to n8n
Before you start, make sure you have:
- A Google Cloud Project with the Admin SDK API enabled
- A Service Account created with Domain-wide Delegation enabled
- A JSON key file downloaded for the Service Account
(Google's official guide →)
Step 1: Download your Service Account JSON key
If you have not already downloaded your key file:
- Go to console.cloud.google.com
- Go to IAM & Admin → Service Accounts
- Click your Service Account
- Go to the Keys tab
- Click Add Key → Create new key
- Select JSON and click Create
- The key file downloads automatically. Keep it somewhere safe
Step 2: Create the credential in n8n
- Open your n8n instance
- Click Settings in the left sidebar
- Click Credentials
- Click Add credential in the top right
- Search for Google and select Google Service Account API
- Open your downloaded JSON key file in a text editor
- Copy the entire contents of the file
- Paste it into the Service Account JSON field in n8n
- Click Save
Step 3: Copy your credential ID
- After saving, look at the URL in your browser
- Copy the ID at the end
Example:
https://your-n8n.com/credentials/ghi789 → your credential ID is ghi789
Troubleshooting
"Error: unauthorized_client"
Domain-wide Delegation has not propagated yet. This can take up to 30 minutes
after enabling it in Google Admin. Wait and try again.
"Error: invalid_grant"
The Service Account key may have been revoked or expired.
Generate a new key in Google Cloud Console and update the credential in n8n.
The workflow cannot suspend Google accounts
Make sure Domain-wide Delegation is enabled for the Service Account and that
the following OAuth scope has been added in Google Admin:
https://www.googleapis.com/auth/admin.directory.user