14 days ago
Hello everyone, I hope you’re doing well. I’ve recently been running into an issue when trying to create new Google-related credentials in N8N (Gmail, Drive, GSheet, etc.).
This is something I’ve done dozens of times for clients using the same template I’ve included below, but this time I really don’t understand where the problem is coming from. For context, I have almost no experience with server or instance deployment.
The issue occurs exactly at the step where I need to provide the URIs for my server requests in the Google Cloud Console while creating an OAuth client ID. Up to that point, everything works fine: my N8N instance is deployed, the consent screen is set up, the app is published, and the APIs I need are all enabled.
But unfortunately, my URIs are not being accepted.
I’ve tried several approaches and here’s what happened in each case:
1. Create an OAuth client ID from a project where it had worked before → Same error
2. Redeploy a new N8N instance → Same error
3. Switch Google Cloud Console account → Same error
4. Deploy the app as internal/external → Same error
5. Test from a different client’s Railway account → Same error
6. Try another N8N template on Railway → Same error
The only case where it worked was when a friend tested on Hostinger with his N8N setup—it worked there. But when he tested on Railway (he’s an old user), he got the same error as me.
So I believe this isn’t an issue affecting only me, but I haven’t seen anyone else mention it directly.
I hope I’m not duplicating an older thread.
Any feedback would be appreciated. And if I’ve missed any important details in my post, please let me know (this is my first time posting here since I started using Railway).
Thanks 🙏🏻
P.S.: I’m currently testing a custom domain setup on Railway to make sure the problem isn’t coming from there.
Project ID : 7616baaf-dae6-4ce1-a3f6-a4e3f27cf7d1
N8N template : https://railway.com/deploy/n8n-with-workers
1 Replies
13 days ago
The issue comes down to the redirect URI not matching what Google expects. On Railway, the default *.up.railway.app domains can change, which breaks OAuth since Google doesn’t allow wildcards.
Here’s what worked for me:
1. Set a stable domain
Use either a custom domain or a permanent Railway domain. Ephemeral URLs will never work with Google OAuth.
2. Configure n8n environment variables on Railway:
N8N_EDITOR_BASE_URL=https://YOUR-STABLE-DOMAIN
WEBHOOK_URL=https://YOUR-STABLE-DOMAIN
N8N_PROTOCOL=https
N8N_HOST=YOUR-STABLE-DOMAIN
3. Use this exact redirect URI in Google Cloud → OAuth client (Web app type):
https://YOUR-STABLE-DOMAIN/rest/oauth2-credential/callback
4. Redeploy and test.
In n8n, when you open the Google credential, the redirect URI it shows must match exactly what you registered in Google. If you still see localhost:5678 or up.railway.app, it means the env vars aren’t set properly.
That’s exactly what I did yesterday, after running several tests and finding out that this was the issue. It worked for my clients as well. Thanks a lot 🙏🏻
That’s exactly what I did yesterday, after running several tests and finding out that this was the issue. It worked for my clients as well. Thanks a lot 🙏🏻