Hi n8n community ![]()
I’m getting an error when trying to connect my Google Sheets credential using OAuth2. After setting up the Client ID and Client Secret, when I click “Sign in with Google”, I get the following error from Google:
Access blocked: This app’s request is invalid
Error 400: redirect_uri_mismatch
Environment:
n8n version: Self-hosted (Hostinger VPS)
Instance URL: https://n8n.srv1724629.hstgr.cloud
Node: Google Sheets → Create Spreadsheet
Credential type: Google Sheets OAuth2 API
Steps to Reproduce:
Open a Google Sheets node in n8n
Create a new credential → Google Sheets OAuth2 API
Enter Client ID and Client Secret from Google Cloud Console
Click “Sign in with Google”
Google shows Error 400: redirect_uri_mismatch
Error Message:
Access blocked: This app’s request is invalid
Error 400: redirect_uri_mismatch
You can’t sign in because this app sent an invalid request.
after we add redirect url error says application error
Hi @Rohit_Kulkarni
This clearly means that the redirect URL you have given does not match with the one you have configured on Google. First I would recommend you to see this to get a better idea of how to set up Google credentials:
And then let me know if the issue persists, as then it will be related to the infrastructure.
please reply somebody
Understood, so for now I would want you to check that your WEBHOOK_URL matches your domain exactly. You can configure it and then restart your instance and try creating another URI on Google Cloud, and with a fresh client ID & secret, try to create a redirect in that. Please let me know how these go.
I can’t understand what you’re trying to say. Can you simplify it?
First, the “attempted action failed” popup you see in your screenshot is likely just a glitch with the Google Cloud website. To fix this, try using an incognito browser window or clearing your cache. Also, make sure you have fully filled out the “OAuth Consent Screen” section in the sidebar, as Google won’t let you save settings if the basic app information is missing.
Second, the “redirect_uri_mismatch” error happens because Google and n8n are not agreeing on the exact web address used for the login process. Think of it as a security handshake; if the address n8n sends to Google is even slightly different from the one you saved in the Google Console, Google will block the connection for security reasons.
To solve this on your Hostinger VPS, you need to make sure n8n knows its own public address. You do this by setting an environment variable called WEBHOOK_URL to your full HTTPS address. Without this, n8n might be sending an internal or incorrect address to Google, which triggers the mismatch error.
Finally, once the server setting is updated, go back to your n8n credential screen and copy the “OAuth Redirect URL” exactly as it appears. Paste that specific link into the Google Cloud Console’s “Authorized redirect URIs” field. Also, ensure your email is added as a “Test User” in the Google Consent Screen so you have permission to log in.
Please verify that you are editing an OAuth Client in a project where you have Editor or Owner permissions, try creating a new OAuth Client instead of editing the current one, wait a few minutes and try again (Google Cloud sometimes experiences temporary interface failures), test with another Google account that has administrative access to the project. In my view, the error is happening at the moment of saving the OAuth Client.
redirect_uri_mismatch is Google telling you the callback n8n sent does not exactly match what is registered in your Google Cloud OAuth client, and the reply above is right that this is the thing to line up. The exact-match part is stricter than people expect.
Concretely: open your Google Sheets credential in n8n and copy the OAuth Redirect URL it shows (it will be https://your-domain/rest/oauth2-credential/callback). Paste that exact string into your Google Cloud Console OAuth client under Authorized redirect URIs, character for character, https not http, no trailing slash difference, your real domain not an IP. On self-hosted (Hostinger), the usual root cause is N8N_EDITOR_BASE_URL not being set to your full https domain, because n8n builds that callback from it, so if the env var is wrong or missing, the URL n8n sends is wrong no matter what you paste into Google.
So check N8N_EDITOR_BASE_URL first, then make the Google Console entry match the callback n8n shows exactly. If both line up and it still fails, confirm your reverse proxy is passing X-Forwarded-Proto https so n8n does not think it is on http. What does the redirect URL in your n8n credential actually show, http or https?
I was undergoing through the same problem, make sure you are not publishing the app, and also putting your emails in the Test Users, if that helps.
