How to Connect Google Sheets and Google Drive to n8n (OAuth Credentials Step-by-Step)
Connect Google Sheets and Google Drive to n8n with OAuth: Cloud sign-in, or a Google Cloud OAuth client for self-hosted n8n, plus fixes for common errors.
You want n8n (a tool that connects apps) to read or update Google Sheets, or to work with files in Google Drive. To do that, n8n needs permission — a one-time sign-in called OAuth. That’s just a secure way of saying "this app may use my Google account".
How you set it up depends on where n8n runs, and that’s where people get stuck. This guide walks you through both paths, and the errors that often appear.
In this guide you’ll learn:
- If you use n8n Cloud: how to click Sign in with Google and be done. You don’t need to set anything up at Google. This is n8n’s Managed OAuth2.
- If you run n8n on your own server (self-hosted): Managed OAuth2 isn’t available, so you create a small project in Google Cloud, turn on the Sheets and Drive features, and paste one web address back into n8n.
- How to fix common messages, such as
redirect_uri_mismatch, "Google hasn’t verified this app", or a connection that stops working after a week.
By the end, you’ll have a working Google sign-in that n8n can reuse in your workflows.
Who this guide is for
- Self-hosted n8n users connecting Google Sheets or Google Drive for the first time.
- n8n Cloud users who want to know when "Sign in with Google" is enough.
- Anyone seeing
redirect_uri_mismatch, "Google hasn’t verified this app", or credentials that stop working after a week.
What you need before you start
- n8n Cloud, or self-hosted n8n that you can open in a browser. This guide was checked against 2.47.4.
- A Google account. For a business, use an account the business owns, not a personal one you might leave.
- For self-hosted n8n: the URL you use to open n8n. Local (
http://localhost:5678) is fine; a public URL must use HTTPS.
Contents
- n8n Cloud: use Sign in with Google
- Self-hosted: create a Google Cloud project
- Enable the Google Drive and Google Sheets APIs
- Configure the OAuth consent screen
- Create the OAuth client and add the redirect URL
- Finish the credential in n8n and test it
- Self-hosting behind a domain or reverse proxy
- Common errors
- Troubleshooting
- Alternatives and limitations
- FAQ
Step 1: n8n Cloud: use Sign in with Google
If you use n8n Cloud, the simple "Sign in with Google" option (Managed OAuth2) is available on all n8n Cloud plans. It covers these Google nodes:
- Google Sheets and Google Sheets Trigger
- Google Drive and Google Drive Trigger
- Gmail and the Gmail Trigger
- Calendar, Docs, Slides and several others
To connect:
- Add a Google Sheets node, for example.
- Under Credential to connect with, choose Create new credential.
- Click Sign in with Google and approve access.
If you prefer your own Google app, n8n’s docs say you can use the dropdown to switch the credential to Custom OAuth2, then follow Steps 2 to 6.
We have not run this sign-in flow on n8n Cloud.
Step 2: Self-hosted: create a Google Cloud project
- Sign in to the Google Cloud Console.
- Open the project dropdown in the top bar and choose New project.
- Enter a Project name (for example "n8n automations"), choose the location, and click Create.
- Check that the project dropdown now shows your new project. Every following step happens inside it.
Step 3: Enable the Google Drive and Google Sheets APIs
- Go to APIs & Services → Library.
- Search for Google Drive API and click Enable.
- Search for Google Sheets API and click Enable.
n8n’s docs note that the Google Sheets, Docs and Slides integrations need the Google Drive API as well as their own API. Enable both, even if you only use Sheets.
Step 4: Configure the OAuth consent screen
- Go to APIs & Services → OAuth consent screen. Google redirects you to the Google Auth Platform overview. Click Get started.
- Enter an App name and a User support email, then click Next.
- Choose the Audience:
- Internal: only for users in your Google Workspace organisation. This is the simplest option if you have Workspace.
- External: any Google account. n8n’s docs say an External app starts in Testing mode, where only the accounts you add as test users can sign in. Everyone else sees "access denied".
- Enter the contact email, accept Google’s User Data Policy, and click Create.
- In the left menu, open Branding. Under Authorized domains, add
n8n.cloud(for n8n Cloud) or your own n8n domain (self-hosted). Then click Save. - If you chose External: open Audience and add your Google account under Test users.
The 7-day catch: Google’s OAuth documentation says that if your app is External with publishing status Testing, its refresh tokens expire after 7 days. The only exception is when you ask for nothing more than basic profile scopes, and Sheets and Drive access are more than that. n8n’s docs give the same warning. You’ll have to reconnect weekly unless you use an Internal app (Workspace) or move the app out of Testing.
Google may require verification for some scopes before an app can leave Testing.
Step 5: Create the OAuth client and add the redirect URL
- In n8n, open your Google Sheets (or Drive) node, create a new credential, and copy the OAuth Redirect URL shown in the credential panel.
- In Google Cloud, go to APIs & Services → Credentials → + Create credentials → OAuth client ID.
- Set Application type to Web application, and give it a recognisable name.
- Under Authorized redirect URIs, click Add URI and paste n8n’s OAuth Redirect URL exactly. On a local install, n8n’s docs say it looks like this:
http://localhost:5678/rest/oauth2-credential/callback
- Click Create. Copy the Client ID and Client Secret from the pop-up.
Google’s redirect URI rules:
- Redirect URIs must use HTTPS. Localhost is the exception.
- The host can’t be a raw IP address (localhost IPs are the exception).
- The top-level domain must be on the public suffix list.
So http://203.0.113.5:5678/... won’t be accepted. Use localhost, or a proper domain with HTTPS.
Keep the Client Secret private. Don’t paste it into chats, screenshots, tickets or Git repositories. Google’s documentation says to store client secrets securely and keep them out of shared source code.
Step 6: Finish the credential in n8n and test it
- Back in n8n, paste the Client ID and Client Secret into the credential.
- Click Sign in with Google. Choose the account you added as a test user (or a Workspace account for an Internal app), and approve access.
- Save the credential. Give it a clear name, such as "Google Sheets – sales account".
- Test it: in the Google Sheets node, choose a simple read operation (for example, getting rows from a sheet), select a test spreadsheet, and run the step. Do the same with a Google Drive node (for example, listing or searching files).
One credential per service: Google Sheets and Google Drive use separate credential types in n8n. You can reuse the same Google Cloud OAuth client (Client ID and Secret) for both, as long as both APIs are enabled in the project. Each credential has the same OAuth Redirect URL on a given n8n instance. We have not confirmed reusing one OAuth client for both credentials in a live instance.
Step 7: Self-hosting behind a domain or reverse proxy
n8n builds its OAuth Redirect URL from its own public address. In the 2.47.4 source, the base URL comes from the first of these that’s set:
N8N_EDITOR_BASE_URL. n8n’s docs describe this as the "Public URL where users can access the editor".N8N_WEBHOOK_URL, or the olderWEBHOOK_URL, which n8n’s docs say is deprecated from 2.35.0.N8N_PROTOCOL+N8N_HOST+N8N_PORT. The defaults arehttp,localhostand5678.
/rest/oauth2-credential/callback is then added to the end.
Behind a reverse proxy (for example https://n8n.example.com → port 5678), n8n’s reverse-proxy docs say to:
- set
N8N_WEBHOOK_URLto your public URL; - set
N8N_PROXY_HOPS=1; - forward the
X-Forwarded-For,X-Forwarded-HostandX-Forwarded-Protoheaders.
export N8N_WEBHOOK_URL=https://n8n.example.com/
export N8N_PROXY_HOPS=1
# Optional, if the editor URL differs from the webhook URL:
export N8N_EDITOR_BASE_URL=https://n8n.example.com/
Restart n8n, then reopen the credential and confirm that the OAuth Redirect URL now starts with https://n8n.example.com. Copy that exact URL into Google.
This follows from the 2.47.4 source; we have not tested it on a proxied instance.
Common errors
Error descriptions and fixes are from n8n’s Google credential troubleshooting docs, unless noted:
| Error | Cause | Fix |
|---|---|---|
redirect_uri_mismatch |
The URL n8n sends doesn’t exactly match one in Google | Copy the OAuth Redirect URL from n8n and paste it exactly, including protocol and port (Steps 5 and 7) |
| "Google hasn’t verified this app" | Normal for an app in Testing | Internal app: use an account in the same organisation. External: add your account as a test user. |
| "Access denied" / "app not verified" | The account isn’t a test user | Add it under Audience → Test users |
invalid_client |
Client ID or Secret doesn’t match | Copy both again from Google Cloud. Watch for stray spaces. |
| Credential stops working after about a week | External + Testing refresh tokens expire after 7 days (Google) | Reconnect, or use an Internal app, or move out of Testing |
401 unauthorized_client in the Drive Trigger |
Drive API not enabled for the project | Enable the Google Drive API (Step 3) |
admin_policy_enforced |
A Workspace admin restricted the scopes (Google OAuth docs) | Ask your Workspace admin |
Troubleshooting
- Is the right project selected in Google Cloud for every step? APIs, consent screen and client must all be in the same project.
- Are both APIs enabled? Sheets needs the Sheets API and the Drive API.
- Does n8n’s OAuth Redirect URL show your public HTTPS address? If it shows
localhoston a server, set the environment variables in Step 7 and restart. - Are you signing in with a test user (External apps)?
- Did it work last week and fail today? That’s the 7-day Testing expiry. Reconnect.
- Can the Google account open the spreadsheet or folder? The credential only sees what that account can access.
Alternatives and limitations
- Service account: n8n’s docs mark Google Sheets, Google Drive and the Drive Trigger as supporting service accounts. They avoid the consent screen, but a service account is a separate Google identity, so files must be shared with it. For the Drive Trigger, n8n says domain-wide delegation is needed. It’s a better fit for Workspace admins.
- n8n Cloud Managed OAuth2: the simplest route if you’re happy on n8n Cloud.
- Generic Google OAuth2 credential: for custom API calls with your own scopes. n8n documents this separately.
- Limitations:
- Google may change the Cloud Console layout and labels.
- Testing-mode tokens expire weekly.
- Publishing an External app with sensitive scopes may need Google verification.
FAQ
Do I need a domain and SSL to use Google OAuth with n8n?
Not for a local install. n8n’s docs say Google accepts localhost redirect URIs. For a server, you need a domain with HTTPS, because Google rejects plain-HTTP and raw-IP redirect URIs.
Why does my n8n Google credential keep expiring?
Most likely, your OAuth app is External and in Testing, where Google expires refresh tokens after 7 days.
Can I use one Google Cloud project for Gmail, Sheets and Drive?
Yes. Enable each API in the same project and reuse the OAuth client. You’ll still create one n8n credential per service.
Is it safe to paste my Client Secret into n8n?
n8n’s docs say credentials are encrypted in the n8n database with its encryption key (N8N_ENCRYPTION_KEY). Never share the secret anywhere else, and rotate it in Google Cloud if it leaks.
Does n8n Cloud need a Google Cloud project?
Not for the nodes that support Managed OAuth2, including Sheets and Drive.
Official references
- n8n docs: Google credentials, Google OAuth2 single service, Google OAuth2 generic, Configure webhook URLs with reverse proxy, Deployment environment variables, Google Sheets node, Google Drive node
- n8n source: UrlService at n8n@2.47.4
- Google: Using OAuth 2.0 to access Google APIs, OAuth 2.0 for web server applications (redirect URI rules)
Next step
Put the credential to work. Our guide to the n8n Google Drive Trigger shows how to start a workflow when a file lands in a folder.
Last updated: 13 November 2026



