Adding a Google Service Account to n8n

Before you start, make sure you have:


Step 1: Download your Service Account JSON key

If you have not already downloaded your key file:

  1. Go to console.cloud.google.com
  2. Go to IAM & Admin → Service Accounts
  3. Click your Service Account
  4. Go to the Keys tab
  5. Click Add Key → Create new key
  6. Select JSON and click Create
  7. The key file downloads automatically. Keep it somewhere safe

Step 2: Create the credential in n8n

  1. Open your n8n instance
  2. Click Settings in the left sidebar
  3. Click Credentials
  4. Click Add credential in the top right
  5. Search for Google and select Google Service Account API
  6. Open your downloaded JSON key file in a text editor
  7. Copy the entire contents of the file
  8. Paste it into the Service Account JSON field in n8n
  9. Click Save

Step 3: Copy your credential ID

  1. After saving, look at the URL in your browser
  2. 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