Skip to content

How to Connect Google API Services with n8n (Drive, YouTube, Gmail, and More)

Integrating Google APIs into n8n allows you to automate tasks like uploading files to Drive, managing YouTube content, reading Gmail messages, or syncing Calendar events. However, because Google enforces strict OAuth 2.0 verification, you need to configure your credentials carefully for each service.

This guide explains how to properly set up and connect any Google API with n8n — the same steps apply to Drive, YouTube Data v3, Gmail, Calendar, and others.


Step 1: Create a Google Cloud Project

  1. Go to Google Cloud Console.
  2. Click Select a projectNew Project.
  3. Name your project (e.g., n8n-automations) and create it.

This project will host all the APIs and credentials that your n8n instance will use.


  1. In the left menu, open APIs & Services → OAuth consent screen.

  2. Choose External as the user type.

  3. Fill in the required app details (App name, support email, developer contact email).

  4. Under Scopes, add the scopes required by your service:

    • For Drive: https://www.googleapis.com/auth/drive
    • For YouTube: https://www.googleapis.com/auth/youtube
    • For Gmail: https://mail.google.com/
    • For Calendar: https://www.googleapis.com/auth/calendar
  5. Scroll down to Test users and add your Gmail address (e.g., menorca.markwayne@gmail.com).

  6. Save the configuration.

This puts your app in Testing mode, allowing only approved test users to authorize it.


Step 3: Enable APIs

Navigate to APIs & Services → Library, then enable the services you plan to use:

  • Google Drive API
  • YouTube Data API v3
  • Gmail API
  • Google Calendar API

You can enable as many as you like under the same project.


Step 4: Create Separate Credentials for Each API

Here’s the key insight:

Each Google API should have its own OAuth 2.0 Client ID and Secret.

Why? Because each API:

  • Uses different scopes.
  • May have different redirect URIs in n8n.
  • Helps you avoid “access_denied” or “token invalid” errors when switching between APIs.

Example naming convention:

  • n8n-drive
  • n8n-youtube
  • n8n-gmail
  • n8n-calendar

To create a credential:

  1. Go to APIs & Services → Credentials.

  2. Click Create Credentials → OAuth Client ID.

  3. Choose Web application.

  4. Name it according to the API you’re connecting (e.g., n8n-youtube).

  5. Under Authorized redirect URIs, add your n8n callback:

    • For n8n Cloud: https://app.n8n.cloud/rest/oauth2-credential/callback
    • For self-hosted n8n: https://your-domain.com/rest/oauth2-credential/callback or http://localhost:5678/rest/oauth2-credential/callback
  6. Save and copy your Client ID and Client Secret.

Repeat this for each API you want to integrate.


Step 5: Connect Each Credential in n8n

  1. In n8n, open Credentials → create a new Google credential.
  2. Choose the appropriate API (Drive, YouTube, Gmail, etc.).
  3. Paste your Client ID and Client Secret.
  4. Authenticate — Google will redirect and ask for permission.

If you see a warning like “Access blocked: app not verified,” that means your consent screen is still in testing mode. Add your Gmail as a test user for that credential and try again.


Step 6: Verify Connection

Once authorization completes, you can test the node:

  • For Drive: list or upload files.
  • For YouTube: fetch video data or upload.
  • For Gmail: read or send an email.

n8n will store the refresh token securely and reuse it for automation.


Bonus: Long-Term Best Practices

  • Use one project (e.g., cloudmateria-n8n) for all Google integrations.
  • Create distinct credentials for each API service — it keeps tokens and scopes isolated.
  • Label credentials clearly using the n8n-<service> prefix for easy management.
  • Stay in Testing mode for personal use — no need to verify with Google unless you’re distributing to the public.
  • If you switch domains or ports, always update your redirect URIs.

Example Summary Setup

ServiceOAuth Client NameAPI EnabledRedirect URI
Google Driven8n-driveDrive APIhttps://app.n8n.cloud/rest/oauth2-credential/callback
YouTuben8n-youtubeYouTube Data API v3Same as above
Gmailn8n-gmailGmail APISame as above
Calendarn8n-calendarCalendar APISame as above

With this structure, your n8n workflows can integrate any Google service smoothly — without scope conflicts or verification errors. Once everything is stable, you can even move from testing to production mode and submit your app for Google verification if you plan to open it to users beyond yourself.