Google OAuth2 (Calendar, Drive, Sheets, Mail, Youtube)

Tag
  1. MAIL
  2. API
Name
Google OAuth2 (Calendar, Drive, Sheets, Mail, Youtube)

Prerequisites

Create a Google Cloud account.

Set up OAuth #

There are five steps to connecting your n8n credentials to Google services:
4.

Create a Google Cloud Console Project

First, create a Google Cloud Console project. If you already have a project, skip to the next section:
1.
Sign in to the Google Cloud Console using your Google credentials .
2.
From the top menu, select the Projects dropdown in the top navigation and select New Project or go directly to the New Project page.
3.
Enter a Project Name and select a Project Location .
4.
Select Create .
5.
Check the top navigation and make sure your project is selected in the Project dropdown. If not, select the project you just created.

Using the API

Once your project is created, enable the APIs you need to access:
1.
Access the Google Cloud Console Library . Make sure you are in the correct project.
Check the Projects dropdown in the top navigation of Google Cloud.
2.
Go to APIs & Services > Libraries .
3.
Search for and select the API you want to enable.
For example, for the Gmail node, we retrieve and enable the Gmail API.
4.
Some integrations may require or require access to other APIs:
From a Google perspective: Request API access .
Google Ads: Get your developer token .
5.
Select Enable .

Configuring the OAuth consent screen

If you have never used OAuth in a Google Cloud project before, you will need to configure the OAuth consent screen :
1.
Access the Google Cloud Console Library . Make sure you are in the correct project.
Check the Projects dropdown in the top navigation of Google Cloud.
2.
Open the left navigation menu and go to APIs & Services > OAuth Consent Screen .
3.
For User Type , select Internal for user access within your organization's Google Workspace, or External for all users with a Google Account .
For more information about user types, see Google's User Types documentation .
4.
Select Create .
5.
Enter the required information:
App name
User Support Email
Email address field in Developer Contact Information
6.
Add in the Verified Domains section: n8n.cloud
If you use n8n's cloud service, add the domain of your n8n instance if you self -host.
7.
Select Save and then Continue to go to the Scope page.
8.
There is no need to set a range.
To go to the summary page , select Save , then select Continue again .
9.
Review the information on the summary page for accuracy.

Creating Google OAuth client credentials

Then generate OAuth client credentials from Google:
1.
In the APIs and Services section, select Credentials .
2.
+ Select Create Credentials > OAuth Client ID .
3.
Select Web Application from the Application Type drop - down .
4.
Google automatically generates a name .
Update to a name recognizable in the console .
5.
Copy the OAuth redirect URL from your n8n credentials . Paste it into Authorized redirect URIs in your Google Console.
6.
Select CREATE .

N8n credentials completed

Complete the n8n credentials with your Google project and credentials fully configured:
1.
Copy the Client ID from the mode you created in Google's OAuth Client .
Enter this entry in your n8n credentials.
2.
Copy the Client Secret from the same Google mode .
Enter this entry in your n8n credentials.
3.
Complete Google authentication by selecting Google Sign-in in n8n .
4.
Save your new credentials .