Google OAuth2 generic
This document contains instructions for creating a generic Google OAuth2 API credential for use with custom operations.
Prerequisites
Create a Google Cloud account.
Set up OAuth
There are five steps to connecting your n8n credential to Google services:
Create a Google Cloud Console project
First, create a Google Cloud Console project. If you already have a project, jump to the next section:
Log in to your Google Cloud Console using your Google credentials.
In the top menu, select the project dropdown in the top navigation and select New project or go directly to the New Project page.
Enter a Project name and select the location (Organization and/or Parent resource) for your project.
Select Create.
Check the top navigation and make sure the project dropdown has your project selected. If not, select the project you just created.

Check the project dropdown in the Google Cloud top navigation
Enable APIs
With your project created, enable the APIs you'll need access to:
Access your Google Cloud Console - Library. Make sure you're in the correct project.

Check the project dropdown in the Google Cloud top navigation Go to APIs & Services > Library.
Search for and select the API(s) you want to enable. For example, for the Gmail node, search for and enable the Gmail API.
Some integrations require other APIs or require you to request access:
Google Perspective: Request API Access.
Google Ads: Get a Developer Token.
Google Drive API required
The following integrations require the Google Drive API, as well as their own API:
Google Docs
Google Sheets
Google Slides
Google Vertex AI API
In addition to the Vertex AI API you will also need to enable the Cloud Resource Manager API.
Select ENABLE.
Configure your OAuth consent screen
If you haven't used OAuth in your Google Cloud project before, you'll need to configure the OAuth consent screen:
Access your Google Cloud Console - Library. Make sure you're in the correct project.

Check the project dropdown in the Google Cloud top navigation Open the left navigation menu and go to APIs & Services > OAuth consent screen. Google will redirect you to the Google Auth Platform overview page.
Select Get started on the Overview tab to begin configuring OAuth consent.
Enter an App name and User support email to include on the Oauth screen. Select Next to continue.
For the Audience, select Internal for user access within your organization's Google workspace or External for any user with a Google account. Refer to Google's User type documentation for more information on user types. Select Next to continue.
Testing mode and test users
If you select External, your app will default to Testing mode. In this mode, only Google accounts you manually add as test users can complete the OAuth flow — everyone else will see an "access denied" screen. See Google hasn't verified this app to learn how to add them.
Select the Email addresses Google should use to contact you about changes to your project. Select Next to continue.
Read and accept the Google's User Data Policy. Select Continue and then select Create.
In the left-hand menu, select Branding.
In the Authorized domains section, select Add domain:
If you're using n8n's Cloud service, add
n8n.cloudIf you're self-hosting, add the domain of your n8n instance.
Select Save at the bottom of the page.
Create your Google OAuth client credentials
Next, create the OAuth client credentials in Google:
Access your Google Cloud Console. Make sure you're in the correct project.
In the APIs & Services section, select Credentials.
Select + Create credentials > OAuth client ID.
In the Application type dropdown, select Web application.
Google automatically generates a Name. Update the Name to something you'll recognize in your console.
From your n8n credential, copy the OAuth Redirect URL. Paste it into the Authorized redirect URIs in Google Console.
OAuth redirect URL for self-hosting
If you're running n8n on your local machine, you don't need a public domain, SSL certificate, or port forwarding to use Google OAuth. Google allows localhost as a valid redirect URI for development purposes. Your n8n OAuth redirect URL will look something like this:
http://localhost:5678/rest/oauth2-credential/callbackFor more details on acceptable redirect URIs, refer to Google's redirect URI documentation.Select Create.
Finish your n8n credential
With the Google project and credentials fully configured, finish the n8n credential:
From Google's OAuth client created modal, copy the Client ID. Enter this in your n8n credential.
From the same Google modal, copy the Client Secret. Enter this in your n8n credential.
You must provide the scopes for this credential. Refer to Scopes for more information. Enter multiple scopes in a space-separated list, for example:
In n8n, select Sign in with Google to complete your Google authentication.
Save your new credentials.
Video
The following video demonstrates the steps described above:
Scopes
Google services have one or more possible access scopes. A scope limits what a user can do. Refer to OAuth 2.0 Scopes for Google APIs for a list of scopes for all services.
n8n doesn't support all scopes. When creating a generic Google OAuth2 API credential, you can enter scopes from the Supported scopes list below. If you enter a scope that n8n doesn't already support, it won't work.
Supported scopes
Gmail
https://www.googleapis.com/auth/gmail.labelshttps://www.googleapis.com/auth/gmail.addons.current.action.composehttps://www.googleapis.com/auth/gmail.addons.current.message.actionhttps://mail.google.com/https://www.googleapis.com/auth/gmail.modifyhttps://www.googleapis.com/auth/gmail.compose
Google Ads
https://www.googleapis.com/auth/adwords
Google Analytics
https://www.googleapis.com/auth/analyticshttps://www.googleapis.com/auth/analytics.readonly
Google BigQuery
https://www.googleapis.com/auth/bigquery
Google Books
https://www.googleapis.com/auth/books
Google Calendar
https://www.googleapis.com/auth/calendarhttps://www.googleapis.com/auth/calendar.events
Google Cloud Natural Language
https://www.googleapis.com/auth/cloud-languagehttps://www.googleapis.com/auth/cloud-platform
Google Cloud Storage
https://www.googleapis.com/auth/cloud-platformhttps://www.googleapis.com/auth/cloud-platform.read-onlyhttps://www.googleapis.com/auth/devstorage.full_controlhttps://www.googleapis.com/auth/devstorage.read_onlyhttps://www.googleapis.com/auth/devstorage.read_write
Google Contacts
https://www.googleapis.com/auth/contacts
Google Docs
https://www.googleapis.com/auth/documentshttps://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.file
Google Drive
https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.appdatahttps://www.googleapis.com/auth/drive.photos.readonly
Google Firebase Cloud Firestore
https://www.googleapis.com/auth/datastorehttps://www.googleapis.com/auth/firebase
Google Firebase Realtime Database
https://www.googleapis.com/auth/userinfo.emailhttps://www.googleapis.com/auth/firebase.databasehttps://www.googleapis.com/auth/firebase
Google Perspective
https://www.googleapis.com/auth/userinfo.email
Google Sheets
https://www.googleapis.com/auth/drive.filehttps://www.googleapis.com/auth/spreadsheets
Google Slide
https://www.googleapis.com/auth/drive.filehttps://www.googleapis.com/auth/presentations
Google Tasks
https://www.googleapis.com/auth/tasks
Google Translate
https://www.googleapis.com/auth/cloud-translation
GSuite Admin
https://www.googleapis.com/auth/admin.directory.grouphttps://www.googleapis.com/auth/admin.directory.userhttps://www.googleapis.com/auth/admin.directory.domain.readonlyhttps://www.googleapis.com/auth/admin.directory.userschema.readonly
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 avoid 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, you can add your email to the list of testers for the app: go to the Audience page and add the email you're signing in with to the list of Test users.
If you need to use credentials generated by another account (by a developer or another third party), follow the instructions in Google Cloud documentation | Authorization errors: Google hasn't verified this app.
Google Cloud app becoming unauthorized
For Google Cloud apps with Publishing status set to Testing and User type set to External, consent and tokens expire after seven days. Refer to Google Cloud Platform Console Help | Setting up your OAuth consent screen for more information. To resolve this, reconnect the app in the n8n credentials modal.
redirect_uri_mismatch
This error means the redirect URI n8n is sending doesn't match any of the URIs registered in your Google Cloud Console OAuth client.
Fix: Copy the OAuth Redirect URL from your n8n credential panel and paste it exactly — including the protocol (http or https) and port number — into the Authorized redirect URIs field of your Google OAuth client.
Access denied / "app not verified"
This usually happens when your app is still in Testing mode and the Google account you're trying to authenticate with hasn't been added as a test user.
Fix: Go to APIs & Services > OAuth consent screen > Test users and add the account you're trying to use.
invalid_client
This error typically means the Client ID or Client Secret in your n8n credential doesn't match what's in Google Cloud Console.
Fix: Go back to your OAuth client in Google Cloud Console, copy both values fresh, and re-enter them in n8n. Watch out for accidental spaces when copying.
Last updated
Was this helpful?