Google#
There are two authentication methods available for Google services nodes, OAuth2 and the Service Account authentication. Refer to the official Google documentation to learn which is appropriate for your case case.
Most nodes are compatible with OAuth2 authentication. Support for Service Account authentication is limited.
Prerequisites#
- Google Cloud account
- Google Cloud Platform project
- If using Google Perspective: Request API Access
- If using Google Ads: Developer Token
Compatible nodes#
Once configured, you can use your credentials to authenticate the following nodes:
Note for n8n Cloud users
For the following nodes, you only need to enter the Credentials Name and click on the Sign in with Google button in the OAuth section to connect your Google account to n8n:
Using OAuth#
From your Google Cloud Console dashboard:
- Click on the hamburger menu and select APIs & Services > Credentials.
-
Click on + CREATE CREDENTIALS and select OAuth client ID.
Note for new users
If you're creating OAuth credentials for the first time, you will have to configure the consent screen.
-
From the Application type dropdown select Web application. A name is automatically generated, change it if desired.
- From the Authorized redirect URIs section, select + Add URI.
- Enter the OAuth Callback URL provided in the Google node credential modal:
- Click the CREATE button.
From your n8n instance:
- Enter your new Client ID and Client Secret from Google Cloud Console in the n8n Credentials modal.
- Enter a Credentials Name.
- Click on the Sign in with Google button to complete your Google authentication.
- Save your new credentials in n8n.
Now you must enable each Google service API that you want to use.
The following video demonstrates the steps mentioned above.
Using Service Account#
From your Google Cloud Console dashboard:
- Click on the hamburger menu and select APIs & Services > Credentials.
- Click on + CREATE CREDENTIALS and select Service account.
- Enter a name in the Service account name field.
- Click on the CREATE button.
- Based on your use-case, you may want to Select a role and Grant users access to this service account using the corresponding sections.
- Click Done.
- Select your newly created service account under the Service Accounts section and open the Keys tab.
- Click on ADD KEY and select Create new key.
- In the modal that appears, select JSON and click Create. n8n saves the file to your computer.
From you n8n instance:
- Enter a Credentials Name.
- In the Service Account Email field, enter the email associated with your new Service Account (visible in the Details tab).
- Enter the Private Key from the downloaded JSON file. If you are running an n8n version older than 0.156.0: replace all instances of
\n
in the JSON file with new lines. - Optional: Click the toggle to enable Impersonate a User and enter the desired email.
- Save your credentials.
Now you must enable each Google service API that you want to use.
The following video demonstrates the steps mentioned above.
Enable APIs#
To enable an API, follow the steps below:
- Access your Google Cloud Console.
- From the hamburger menu select APIs & Services > Library.
- Search for and select the API(s) you want to enable.
- Click on the ENABLE button.
Troubleshooting#
Google hasn't verified this app#
If using the OAuth authentication method, you might come across the warning Google hasn't verified this app. To avoid this, you can create OAuth credentials from the same account you want to authenticate. However, if you're using credentials that were generated by another account (by a developer or another third party), do the following:
- Click on Advanced.
- Click on Go to CREDENTIALS_NAME (unsafe).
CREDENTIALS_NAME
is the name of the credentials created by the third party. - Grant the requested permissions.
Service Account cannot access Google Drive files#
A Service Account can only access Google Drive files and folders that were shared with it's associated user email.
- Access your Google Cloud Console and copy your Service Account email.
- Access your Google Drive and go to the designated file or folder.
- Right-click on the file or folder and select Share.
- Paste your Service Account email into Add People and groups.
- Select Editor for read-write access or Viewer for read-only access.