Connecting to Google with Self-Host on Railway

Google Sheets Credentials Issue

I am using a self-hosted instance of n8n on Railway and I am trying to create a workflow that uses Google Sheets. I followed these instructions (Google OAuth2 single service | n8n Docs) step by step, multiple times, and I was never able to get the connection to work. When I would go back to n8n to set up the connection, I am met with an authorization error. I have attached some images for reference.

I really think that I set up everything correctly in Google Cloud Console, I even tried following many different video tutorials and I would always have the same outcome.

2 Likes

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I believe this is because if you have not published the google cloud app, then you need to add a test user to gain access to it. So if you go to the enabled APIs and services tab, then navigate to the OAuth consent screen tab, you should see a section saying add test users. Simply add the email you use to access the google cloud app and this should fix the problem.

3 Likes

I’ve been having what sounds like very similar issues trying to connect my Google Drive/Google Drive Node in what should be simple connections, I mean I’ve literally killed 3 full (vacation) days trying to troubleshoot, and have had Gemini models and Claude models help run every single configuration variation within a pretty tight range in Google Cloud Console, but I’m getting the same errors…very frustrating!

I did add my email as a test user already but I get the same issue. The authorization issue occurs right when I get redirected, I do not even have a chance to add the test user.

Thank you for trying to help!

I’ve done all of the above numerous times as well, and getting the same error messages as the ones you posted Dragan! Really starting to think that the issue is with the n8n platform, and something not wired correctly

I’d suggest watching this video: https://www.youtube.com/watch?v=3Ai1EPznlAc

Hopefully you can fix the problem after following these steps. Good luck!

Dragan, are you able to install the Google Drive node in a workflow? I just tried with a google sheet and got the same errors

I have not tried yet. Are you able to set up the credentials for the Google Drive node?

  • n8n version: 1.72.1
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): manual
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Railway (Docker)
  • Operating system: MacOS

Yes, I tried following this video as well, but I am getting the same error.

I’m having the same issue. What I see is that the OAuth Redirect URL provided in railway Google nodes for authentication don’t include the https:// at the beginning of the link. If I copy the link in Google Cloud Authorized redirect URIs as is, Google won’t accept it, and if I do, then I get the 400 error message when the node is being triggered as I assume they are mismatching. I don’t know who in railway or n8n is responsible for aligning the provided uri properly formed…

by the way, when I try this in a local instance, I get the OAUth Redirect URL from the Google node with https:// at the beginning and the connection works without issue…

I fixed the issue. Go to the n8n main instance and in the variables, look for the WEBHOOK_URL variable at the bottom, edit it, and change its value to https://${{RAILWAY_PUBLIC_DOMAIN}}. Now you should be able to connect to Gmail, google calendar, Pinecone, etc…

3 Likes

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