Skip to content
New: a free website for your business, live in 48 to 72 hoursWorkflow automation on n8n and Claude, built for your businessFixed price, agreed before we start · Live in 5 to 10 business days30-day money-back guarantee on every planProfessional firms · Agencies · E-commerceYou own every workflow, in your own n8nClaude API: your data is not used for trainingHuman approval on every sensitive stepFree automation audit, no obligation
PURIST
30 days
Money-back window
14 h/wk
Modeled time saved
99.97%
Uptime SLA
< 7 days
Deploy time
PURIST AI
Claude Opus 4.7 · n8n v1.71 · <80ms
What type of business are you running? I'll show you exactly which processes we'd automate first and your estimated ROI.
Powered by n8n + Claude Opus 4.7 Get my free automation plan →
Fix redirect_uri_mismatch for n8n OAuth2 Credentials (Google, Microsoft and More)
Guides 6 min read · 1,181 words

Fix redirect_uri_mismatch for n8n OAuth2 Credentials (Google, Microsoft and More)

"Error 400: redirect_uri_mismatch" means the redirect URL n8n sends is not registered in the provider's console. How to copy it exactly, and why self-hosted instances sometimes send the wrong one.

Steve, founder of PURIST

November 6, 2026

PURIST: Stuck on n8n? Our n8n experts fix and build workflows like this one, at a fixed price →

You click "Sign in with Google" in an n8n credential and Google answers "Error 400: redirect_uri_mismatch". OAuth providers only send the user back to addresses you registered in advance. n8n sent one that is not on the list. The fix takes two minutes once you know which URL to copy and where to paste it.

In short. Copy the OAuth Redirect URL shown in the n8n credential and paste it exactly into the provider's authorised redirect URIs (for Google: Google Cloud Console > Credentials > your OAuth client). Protocol, domain, port and path must match character for character. If n8n shows http://localhost:5678/... while you reach it at an https domain, fix the instance's public URL first.

Fix redirect_uri_mismatch for n8n OAuth2 Credentials (Google, Microsoft and More): workflow diagram
The redirect URL n8n sends must match the one registered in the provider console exactly. Illustration: PURIST.

Step 1: copy the URL from n8n

Open the credential in n8n. The OAuth Redirect URL field shows the address n8n will send. On a self-hosted instance it looks like:

text
https://n8n.example.com/rest/oauth2-credential/callback

On n8n Cloud, use exactly the URL displayed in your credential.

Step 2: paste it in the provider console

For Google, as described in the n8n documentation:

  1. 1 Google Cloud Console > APIs & Services > Credentials.
  2. 2 Open your OAuth client of type Web application.
  3. 3 Under Authorized redirect URIs, add the URL copied from n8n.
  4. 4 Save, wait a minute, and retry the sign-in in n8n.

Other providers (Microsoft, HubSpot, Slack, Xero...) have the same field under names such as "Redirect URI" or "Callback URL".

Fix redirect_uri_mismatch for n8n OAuth2 Credentials (Google, Microsoft and More): node settings
What to copy from the n8n credential, and where to paste it in the provider console. Illustration: PURIST.

Why it still does not match

DifferenceExample
Protocolhttp:// registered, n8n sends https://
Domainn8n.example.com vs www.n8n.example.com
Portlocalhost:5678 vs localhost
Trailing slash or path/callback/ vs /callback
Wrong OAuth clientCredential uses a client ID from another project

Compare the URL in the error details (Google shows the redirect_uri it received) with the registered one, letter by letter.

Self-hosted: n8n shows localhost or http

Behind a reverse proxy, n8n does not know its public address unless you tell it. If the OAuth Redirect URL in the credential shows http://localhost:5678, the provider will either reject it or redirect your browser to a dead address.

n8n builds the redirect URL from N8N_EDITOR_BASE_URL. If that is not set, it uses N8N_WEBHOOK_URL, and otherwise it combines N8N_PROTOCOL, N8N_HOST and N8N_PORT. Behind a proxy, the last option produces the internal address. Set the public URL explicitly, then restart:

bash
export N8N_EDITOR_BASE_URL=https://n8n.example.com/
export N8N_WEBHOOK_URL=https://n8n.example.com/
export N8N_PROXY_HOPS=1

Reopen the credential, check that the OAuth Redirect URL now shows your https domain, and register that one. Setting N8N_WEBHOOK_URL also fixes webhook addresses behind the same proxy (see n8n webhook URLs).

Local testing with Google

The n8n documentation notes that Google accepts localhost as a redirect URI for development, so a local instance at http://localhost:5678/rest/oauth2-credential/callback works without a domain or SSL, as long as you register exactly that URL.

  • Access denied or "app not verified": the OAuth consent screen is in Testing mode and your account is not a test user. Add it under OAuth consent screen > Test users.
  • invalid_client: the client ID or secret in n8n does not match the console. Copy both again and watch for spaces.

Worked example: Google Sheets on a self-hosted instance behind Caddy

Your n8n runs in Docker behind Caddy at https://n8n.example.com. Connecting a Google Sheets credential fails with redirect_uri_mismatch.

  1. 1 Open the credential in n8n and read the OAuth Redirect URL. It shows http://localhost:5678/rest/oauth2-credential/callback. That is the problem: n8n does not know its public address.
  2. 2 Set the public URL in the n8n environment and restart:
yaml
environment:
  - N8N_EDITOR_BASE_URL=https://n8n.example.com/
  - N8N_WEBHOOK_URL=https://n8n.example.com/
  - N8N_PROXY_HOPS=1
  1. 1 Reopen the credential. The OAuth Redirect URL now reads https://n8n.example.com/rest/oauth2-credential/callback.
  2. 2 Google Cloud Console: APIs & Services > Credentials > your OAuth client (type Web application) > Authorized redirect URIs > add that exact URL > Save.
  3. 3 Consent screen: if the app is in Testing mode, add your Google account under Test users.
  4. 4 Enable the API you need (Google Sheets API) in the same project.
  5. 5 Back in n8n, Sign in with Google.

Where to paste the URL, provider by provider

The field names differ; the rule does not.

ProviderWhere the redirect URL goes
GoogleOAuth client > Authorized redirect URIs
Microsoft (Entra ID)App registration > Authentication > Redirect URIs (Web)
SlackApp > OAuth & Permissions > Redirect URLs
HubSpotApp > Auth > Redirect URL
XeroApp > Redirect URIs

Paste the URL copied from the n8n credential, not one typed from memory.

Errors that look similar

MessageReal causeFix
redirect_uri_mismatchURL not registered exactlyCopy from n8n, paste in the console
invalid_clientWrong client ID or secretCopy both again, no spaces
access_denied, "app not verified"Testing mode, user not a test userAdd the account as a test user
invalid_scopeScope not enabled for the appEnable the API and scopes in the console
Works once, fails days laterTesting-mode tokens can expire; consent revokedPublish the app or reconnect

Frequently asked questions

What redirect URI should I use for n8n?

The exact OAuth Redirect URL shown in your n8n credential. On self-hosted instances it ends with /rest/oauth2-credential/callback.

Why does n8n show a localhost redirect URL on my server?

The instance does not know its public address. n8n builds the redirect URL from N8N_EDITOR_BASE_URL (or N8N_WEBHOOK_URL if it is not set). Set it to your public https URL and restart.

How long does Google take to accept a new redirect URI?

Usually a minute or less, sometimes a few minutes. Retry after saving.

Do I need a domain and SSL to use Google OAuth with n8n?

Not for local development: Google accepts localhost redirect URIs. In production, use your https domain.

Why does Google say "This app is blocked" when connecting n8n?

The OAuth app requests sensitive scopes and is not verified, or the account is not a test user. Add the account as a test user while in Testing mode.

Do I need a separate OAuth client for each n8n instance?

Each instance has its own redirect URL. You can register several redirect URIs on one client, or create one client per environment for clarity.

Does N8N_WEBHOOK_URL affect the OAuth redirect URL?

n8n builds the redirect URL from N8N_EDITOR_BASE_URL, and falls back to N8N_WEBHOOK_URL when the first is not set.

Tags

n8noauth2googlecredentialserror
Steve, founder of PURIST

Steve founded PURIST, a workflow automation studio working with n8n, Make and Claude AI, and is the point of contact on every project. Prices and features in our articles come from vendor documentation and public pricing pages. How we research and score tools.

Complete guide

Automation Tools & Platforms

11 min read n8n Code Node: 15 JavaScript Examples You Can Copy and … 8 min read n8n Code Node With Multiple Inputs: 3 Methods That Work 7 min read Fix "Cannot find module" in the n8n Code Node (npm Pack… 7 min read n8n Code Node Errors Fixed: "Code doesn't return items … 7 min read $env and Credentials in the n8n Code Node: What Works a… 7 min read n8n Code Node Binary Data: Read, Change and Return File… 7 min read Python in the n8n Code Node (n8n 2.x): Setup, Syntax an… 7 min read Fix n8n "The requested webhook is not registered" (Test… 6 min read n8n Webhook URL: Test vs Production, and How to Change … 7 min read n8n Respond to Webhook: Return JSON, Status Codes, Redi… 8 min read Secure an n8n Webhook: Header Auth, Basic Auth, JWT and… 7 min read n8n Webhook Not Working? 10 Causes and How to Fix Each … 7 min read n8n HTTP Request Pagination: Every Pattern With Working… 7 min read n8n HTTP Request Authentication: API Keys, Bearer Token… 7 min read n8n HTTP Request Timeout and "Aborted" Errors: Causes a… 7 min read Upload and Download Files With the n8n HTTP Request Nod… 6 min read Fix ECONNREFUSED in n8n: Docker, localhost and 127.0.0.… 6 min read n8n 429 Too Many Requests: Batching, Retries and Rate L… 7 min read n8n Expression Errors Fixed: "Referenced node is unexec… 6 min read Anatomy Claude skill: what it is, how to install it, an… 5 min read How to explain a business process with the Anatomy skil… 5 min read Anatomy vs Mermaid vs Excalidraw: which to explain a wo… 14 min read n8n LinkedIn Job Automation: Auto-Apply, Track, and Fol… 16 min read n8n HTTP Request Node: Complete Documentation and Examp… 18 min read The future of automation: how our engineering team is s… 8 min read n8n vs Make vs Zapier: the honest comparison your busin… 11 min read n8n vs Make vs Zapier: an honest comparison for product… 7 min read Webhook vs polling: the architecture decision that dete… 24 min read n8n tutorial: build your first production workflow in u… 26 min read The 9 best Zapier alternatives in 2026: an honest ranki… 21 min read Make.com tutorial: build powerful automations without c… 19 min read Automation consultant vs DIY: how to decide what is rig… 14 min read n8n Self-Hosted vs Cloud: The Complete Decision Guide (… 15 min read 5 Zapier Free Alternatives That Handle Real Production … 15 min read WhatsApp Business Automation With n8n: Build a 24/7 Cus… 17 min read Google Workspace Automation: 15 Workflows for Sheets, D… 16 min read Claude AI for Business Automation: What It Does, What I… 15 min read Airtable Automation With n8n: 10 Workflows That Make Yo… 15 min read Droven.io AI Automation Tools: Full Review and Best Alt… 14 min read Droven.io RPA and Business Automation: An Honest 2026 R… 15 min read Enterprise Workflow Automation: The Complete Guide for … 13 min read Document Workflow Automation: Software, Implementation,… 14 min read Marketing Automation Workflow: From Content Creation to… 16 min read Ad Campaign Workflow Data Model and SDR Inbound Pipelin… 14 min read ComfyUI Workflows for Business: Product Photography, Ma… 13 min read GPT-5.2 for Business Workflows and the spec-workflow-mc… 17 min read ServiceNow vs IBM BAW vs n8n: Enterprise Workflow Autom… 16 min read 9 Best Workflow Automation Tools for Small Business in …

Keep reading

More from the blog.

All articles

From audit to deployment

Experience the automation
these articles are about.

Get my free automation plan →