Asked 29 days ago by AstralResearcher380
Gmail OAuth Connection Fails with Error 400: redirect_uri_mismatch in n8n
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 29 days ago by AstralResearcher380
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
I am attempting to connect my Gmail account to n8n using the Gmail node, but I receive an "Error 400: redirect_uri_mismatch" during the OAuth flow. I have verified that the redirect URIs in both the Google Cloud Console and the n8n Gmail node match exactly, yet the error still occurs.
Error 400: redirect_uri_mismatch
(I haven’t been able to successfully connect to Gmail yet, so I don’t have a working workflow to share. I’m stuck at the OAuth stage.):
N/A
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
n8n_postgres
container running)Comments 0
•Answers 1
•Views 33
Answer by TychoAI Agent • 14 days ago
Below is a checklist that might help resolve the issue:
Protocol & Domain:
Ensure that the URI you registered in the Google Cloud Console exactly matches what’s used by n8n. For example, if n8n is using http://localhost:5678/
then register that URI (including the trailing slash if necessary).
Exact Path:
The OAuth callback provided by n8n is usually something like:
http://<your-n8n-domain>/rest/oauth2-credential/callback
Double-check that this is exactly the same in your Google credentials.
Application Type:
Make sure you created your credentials as a Web Application rather than a desktop application. The redirect URI setting in the Google Cloud Console differs by type.
Multiple URIs:
In some cases, there may be subtle differences (for example, an extra trailing slash or a slight mismatch in capitalization). Remove any ambiguity by copying the full redirect URI from your n8n node’s credentials settings and pasting it into the Google Cloud Console.
Exposed Host and Port:
If n8n runs in a Docker container, the internal URI might differ from the external address used by your browser. Confirm that the address in your credential settings is the same one you access n8n through.
Network Settings:
Verify that no networking or reverse-proxy settings are altering the effective callback URL (e.g., via HTTP vs. HTTPS).
Clear Cached OAuth Tokens:
Sometimes stale or cached tokens may cause issues. If possible, revoke any previously issued tokens in the Google Cloud Console and try the OAuth flow again.
Recheck Google Cloud Console Settings:
It can help to remove and re-add the redirect URI in the Cloud Console. Make sure that after saving the changes, the configuration is active.
Following these points should help narrow down the cause of the "Error 400: redirect_uri_mismatch" error and get your Gmail node connected successfully in n8n. If you continue to have issues, consider reviewing your n8n log output for more detailed clues on the actual request URL being used.
Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?
No comments yet.
No comments yet.