Automated Google OAuth Credential Setup - n8n Workflow

Use this powerful n8n workflow to rapidly automate the creation of multiple Google OAuth2 credentials (Gmail, Sheets, Drive) within your n8n instance using the specialized n8n node for API interaction.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

• n8n administrators managing multi-tenant or multi-account Google integrations.
• Users who frequently set up new Google accounts across different n8n templates.
• Technical users looking to implement DevOps practices for n8n credential management.

Overview

Manually creating credentials for every single Google service (Gmail, Google Sheets, Google Drive, etc.) within n8n can be tedious and prone to naming errors. This specialized n8n workflow solves this problem by automating the entire setup process. By simply providing your Google OAuth 2.0 Client JSON file and your associated email address, this n8n automation creates separate, clearly named OAuth credentials for all common Google APIs. This not only saves significant time but ensures consistency when deploying or managing large sets of n8n templates that rely on Google services. The entire process leverages the internal n8n node functionality to interact with the credentials API.

How it Works

This automation begins with a manual n8n trigger, designed to run only when initiated by the user.


  1. Configuration Input: The workflow first captures the required configuration inputs: the full Google OAuth 2.0 Client JSON file (containing the client ID and secret) and the specific Google Email address associated with the credentials.

  2. Service Definition: A centralized list of targeted Google API services (e.g., googleSheetsOAuth2Api, gmailOAuth2) is defined using an n8n node.

  3. Iteration: The Split Out n8n node takes this list of services and creates an individual item for each service, ensuring that subsequent steps are executed repeatedly.

  4. Credential Creation: For every service item, the powerful built-in n8n Create Credentials n8n node is invoked. It dynamically constructs the credential name using the provided email and the specific service type (e.g., [email protected] - gmailOAuth2). It uses the Client ID and Secret extracted from the initial JSON input to finalize the credential creation via the n8n API.

  5. Finalization: After running the n8n workflow, the credentials are created in your n8n instance, although the user must still manually log in to each newly created credential to authorize access.

Installation Guide

To deploy this useful n8n workflow, follow these steps:


  1. Import: Download the provided n8n workflow JSON and import it into your n8n instance.

  2. n8n API Key Setup: You must first configure an n8n API credential. Navigate to 'Credentials' in your n8n interface, create a new API Key credential, and ensure it has sufficient permissions to modify system credentials. Apply this credential to the 'n8n Create Credentials' n8n node.

  3. Google JSON Setup: Obtain your OAuth 2.0 Client JSON file from the Google Cloud Console. Edit the 'Google JSON' n8n node and paste the entire JSON content into the raw data field.

  4. Google Email Setup: Edit the 'Google Email' n8n node and replace the placeholder value with the actual email address associated with these credentials.

  5. Execution: Click the 'Test workflow' n8n trigger button. The workflow will run and create all specified Google service credentials automatically.

Node Details

This advanced n8n workflow utilizes several core n8n node types:

When clicking ‘Test workflow’ (Manual Trigger): This simple n8n trigger starts the execution of the n8n workflow manually.
Google JSON (Set Node): Function: Stores the entire Google OAuth 2.0 client JSON configuration. Key Configuration: Set to raw JSON mode, holding the clientid and clientsecret used for credential creation.
Google Email (Set Node): Function: Stores the user's email address, which is used for standardized naming of the resulting credentials.
Services (Set Node): Function: Defines the array of desired Google API services (e.g., Google Sheets, Gmail, Drive). Key Configuration: Contains a list of standard n8n OAuth credential types.
Split Out (Flow Control Node): Function: Crucial for flow control, this n8n node iterates over the array of services, ensuring that the credential creation process is executed individually for each service type.
n8n Create Credentials (n8n Node): Function: The core action. This specialized n8n node uses the internal n8n API to create new credentials dynamically. Key Configuration: Credentials are named using an expression combining the email and service type, and the clientId and clientSecret are dynamically pulled from the 'Google JSON' input.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by
Jordan Haisley
Jordan Haisley

Featured*