(self dumb mistake, no issue actually.....) Google OAuth With redirect_uri_mismatch Error

:wrench: Help Needed: Google OAuth redirect_uri_mismatch with n8n on Synology Docker Setup

Hi everyone, I’m encountering a redirect_uri_mismatch error while trying to set up Google OAuth in n8n running on Synology Docker.

Here’s my setup:

  • n8n is running in Docker on my Synology NAS.
  • Docker port mapping: 56787:5678
  • Synology Reverse Proxy: https://example.com:56788http://localhost:56787
  • Router NAT: External 56788 → Internal 56788
  • In Google Cloud Console, my authorized redirect URI is:
https://example.com:56788/rest/oauth2-credential/callback

But when I try to connect Google OAuth in n8n, I get this error:

Error 400: redirect_uri_mismatch
Requested redirect URI: https://example.com:56788/rest/oauth2-credential/callback?flowName=GeneralOAuthFlow

:white_check_mark: I did include the exact same redirect URI in Google Console (without the query string, of course).

I’ve confirmed the following:

  • HTTPS is used
  • Port 56788 is reachable from the internet
  • Domain and URI path are correct
  • No typos or trailing slashes
  • I’m editing the correct OAuth 2.0 client in the correct Google project
  • Set env variable:
    N8N_HOST=example.com
    N8N_EDITOR_BASE_URL=https://example.com:56788
    WEBHOOK_URL=https://example.com:56788
    

Still, I get the mismatch error. Any ideas what might be causing this?
Could it be due to caching in n8n, or something subtle in Google Cloud?

Thanks in advance for any help!

Information on your n8n setup

  • n8n version: 1.93.0
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Synology DSM 7.2.2-72806 Update 3
1 Like

try setting WEBHOOK_URL=https://example.com:56788 in your n8n env bro, usually this fixes it when running behind reverse proxy, coz n8n might be sending wrong internal url to google

1 Like

I forget to say I already have set the env variable below:

N8N_HOST=example.com
N8N_EDITOR_BASE_URL=https://example.com:56788
WEBHOOK_URL=https://example.com:56788

So in my web view, I actually saw the callback url https://example.com:56788/rest/oauth2-credential/callback when I open the Google OAuth setup panel.
And I also set the url to the google workspace oauth uri and save, but it was still not working…:sweat:

maybe try without the port on webhook URL, your need to change ure proxy aswell, you could also use a tunnel like cloudflare be much easier

1 Like

But I need to set it on the port because the normal port like 80 or 443 already in used😓
I want to try to accomplish on my own Synology NAS (Not me loving it just 'cause it’s free :smiling_imp:)

subdomain it? then u should have 443 available, did u look at cloudflare tunnel? might be much easier

1 Like

Oooops…, Sorry for wasting your time — it was a dumb mistake on my part.
I found I use the other google workspace for setting up the OAuth…:upside_down_face:

So everything is well now!!! Thanks you for looking on it!!!

2 Likes

Ahh yer that old cookie haha, glads it working :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.