Setting Up Google OAuth2 Credentials in n8n

Google Drive, Gmail & Google Calendar

This guide walks you through creating Google OAuth2 credentials for Google Drive, Gmail, and Google Calendar in n8n. One Google Cloud project and one set of OAuth credentials covers all three services.

Official Reference: n8n Docs — Google OAuth2 Single Service


Prerequisites

  • A Google Cloud account
  • Access to your n8n instance (self-hosted or cloud)


Overview

There are five steps to connecting your n8n credential to Google services:

  1. Create a Google Cloud Console project
  2. Enable APIs
  3. Configure your OAuth consent screen
  4. Create your Google OAuth client credentials
  5. Finish your n8n credential


Step 1: Create a Google Cloud Console Project

If you already have a project, skip to Step 2.

  1. Log in to your Google Cloud Console using your Google credentials.
  2. In the top menu, select the project dropdown in the top navigation and select New project, or go directly to the New Project page.
  3. Enter a Project name (e.g. n8n Integrations) and select the Location for your project.
  4. Select Create.
  5. Check the top navigation and make sure the project dropdown has your new project selected. If not, select the project you just created.

Check the project dropdown in the Google Cloud top navigation


Step 2: Enable APIs

With your project created, enable the APIs you need for Google Drive, Gmail, and Google Calendar.

  1. Access your Google Cloud Console — Library. Make sure you’re in the correct project.

Check the project dropdown in the Google Cloud top navigation

  1. Go to APIs & Services → Library.

  2. Search for and enable each of the following APIs (click into each one and hit Enable):

| n8n Node | API to Enable |
|—|—|
| Google Drive | Google Drive API |
| Gmail | Gmail API |
| Google Calendar | Google Calendar API |

  1. Select ENABLE for each API.


If you haven’t used OAuth in your Google Cloud project before, you’ll need to configure the OAuth consent screen.

  1. Access your Google Cloud Console. Make sure you’re in the correct project.
  2. Open the left navigation menu and go to APIs & Services → OAuth consent screen.
  3. Google will redirect you to the Google Auth Platform overview page. Select Get started on the Overview tab to begin configuring OAuth consent.

App Information

  1. Enter an App name (e.g. n8n) and User support email to include on the OAuth screen.
  2. Select Next to continue.

Audience

  1. Select the audience type:
    • Internal — for user access within your organization’s Google Workspace only
    • External — for any user with a Google account

Refer to Google’s User type documentation for more information on user types.

  1. Select Next to continue.

Contact Information

  1. Select the Email addresses Google should use to contact you about changes to your project.
  2. Select Next to continue.

Agreement

  1. Read and accept Google’s User Data Policy.
  2. Select Continue and then select Create.

Add Authorized Domains

  1. In the left-hand menu, select Branding.
  2. In the Authorized domains section, select Add domain:
    • If you’re using n8n Cloud: add n8n.cloud
    • If you’re self-hosting: add the domain of your n8n instance (e.g. yourdomain.com)
  3. Select Save at the bottom of the page.


Step 4: Create Your Google OAuth Client Credentials

Next, create the OAuth client credentials in Google.

  1. Access your Google Cloud Console.
  2. In the APIs & Services section, select Credentials.
  3. Select + Create Credentials → OAuth client ID.
  4. In the Application type dropdown, select Web application.
  5. Google automatically generates a Name. Update the name to something recognizable (e.g. n8n OAuth Client).

Set the Redirect URI

  1. If you’re self-hosting:

    • From your n8n credential, copy the OAuth Redirect URL.
    • Paste it into the Authorized redirect URIs in Google Console.
    • The URL format is typically: https://<your-n8n-domain>/rest/oauth2-credential/callback

  2. If you’re using n8n Cloud:

    • You can leave this field empty as the OAuth setup is pre-configured and the callback URL is fixed.

  3. Select Create.

  4. You’ll see a modal with your Client ID and Client Secretcopy both and keep them safe.


Step 5: Finish Your n8n Credential

With the Google project and credentials fully configured, finish setting up your credentials in n8n. You’ll create three separate credentials — one for each service — but they all use the same Client ID and Client Secret.

Google Drive Credential

  1. In n8n, go to Credentials → Add Credential → Google Drive OAuth2 API.
  2. If self-hosted:
    • Paste the Client ID from the Google OAuth client modal.
    • Paste the Client Secret from the same modal.
  3. Select Sign in with Google to complete authentication.
  4. Choose your Google account, click through any “unverified app” warning (see Troubleshooting below), and grant access.
  5. Save the credential.

Gmail Credential

  1. In n8n, go to Credentials → Add Credential → Gmail OAuth2 API.
  2. Paste the same Client ID and Client Secret.
  3. Select Sign in with Google → authorize → Save.

Google Calendar Credential

  1. In n8n, go to Credentials → Add Credential → Google Calendar OAuth2 API.
  2. Paste the same Client ID and Client Secret.
  3. Select Sign in with Google → authorize → Save.


Troubleshooting

“Google hasn’t verified this app”

If using the OAuth authentication method, you might see the warning “Google hasn’t verified this app”. To handle this:

  • If your app User Type is Internal: create OAuth credentials from the same account you want to authenticate.
  • If your app User Type is External: add your email to the list of testers for the app:
    1. Go to the Audience page in Google Cloud Console.
    2. Add the email you’re signing in with to the list of Test users.
  • When you see the warning screen, click Advanced → Go to app name to proceed.

Refer to Google Cloud documentation: Authorization errors for more details.

Google Cloud App Becoming Unauthorized (Token Expiry)

For Google Cloud apps with:

  • Publishing status set to Testing
  • User type set to External

Consent and tokens expire after seven days.

To prevent this from happening:

  1. Go to APIs & Services → OAuth consent screen in Google Cloud Console.
  2. Click Publish App to move the app out of Testing mode.
  3. You do not need to go through Google’s full verification process for your own personal use — just publishing it removes the 7-day token expiry.

To resolve expired tokens, reconnect the app in the n8n credentials modal by editing the credential and clicking Sign in with Google again.

URL Mismatch Errors

If you see an error indicating that you can’t sign in because the app doesn’t meet Google’s expectations:

  • The actual cause is usually that the URLs don’t match between Google’s OAuth configuration and n8n.
  • Review any links included in Google’s error message for details.
  • If self-hosting, verify that the N8N_EDITOR_BASE_URL and WEBHOOK_URL environment variables use fully qualified domains.


Quick Reference

What Where
Google Cloud Console console.cloud.google.com
API Library console.cloud.google.com/apis/library
OAuth Consent Screen APIs & Services → OAuth consent screen
Credentials APIs & Services → Credentials
n8n Docs (full reference) Google OAuth2 Single Service

Video Walkthrough

n8n provides a video walkthrough of this process on the official docs page.