Skip to content

Gmail OAuth2 Credential - redirect_uri_mismatch Error on n8n Cloud #23650

Description

@lorenzotalia

When attempting to connect a Gmail account via OAuth2 to the Gmail credential in n8n Cloud, the Google OAuth flow fails with a redirect_uri_mismatch error. This prevents any Gmail OAuth credentials from being configured on n8n Cloud.

Steps to Reproduce:

Go to Credentials in n8n Cloud project
Create or edit a "Gmail account" credential (Gmail OAuth2 API)
Click "Sign in with Google" button in the Connection tab
User is redirected to Google OAuth, then blocked with error

## What is the error message (if any)?
Error 400: redirect_uri_mismatch
"You can't sign in because this app sent an invalid request. You can try again later, or contact the developer about this issue."

The error indicates that n8n Cloud's OAuth redirect URI does not match what is registered in Google Cloud Console:

Expected redirect URI: https://lorenzotalia.app.n8n.cloud/rest/oauth2-credential/callback
Status: Blocked by Google due to mismatch

Image

{
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.googleDocs",
"typeVersion": 2,
"position": [
128,
208
],
"id": "e181ff08-e9f2-47b3-ac10-4e9ced848000",
"name": "Create a document",
"credentials": {}
}
],
"connections": {},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "220c1224c0751a953d344fc9b8bc488bd91805a6d5e01e2db07f709dbb1e1144"
}
}




## Share the output returned by the last node
<!-- If you need help with data transformations, please also share your expected output. -->


Expected behavior
When user clicks "Sign in with Google", they should:

Be redirected to Google OAuth consent screen
Accept permissions
Be redirected back to n8n
Credential should be marked as "connected" (not "Needs first setup")
Gmail nodes should be usable immediately
Actual behavior
Google rejects the OAuth request with redirect_uri_mismatch error, preventing the credential from being completed. User is left with "Needs first setup" status indefinitely.

Environment
Platform: n8n Cloud (not self-hosted)
Credential Type: Gmail OAuth2 API
Account: Free trial (14 days remaining)
Browser: Chrome/Windows
Possible root cause
The OAuth redirect URI registered in the Google Cloud project backing n8n Cloud's "Sign in with Google" feature does not include or match the current n8n Cloud instance domain. This is a backend configuration issue in n8n's OAuth setup.

Workaround needed
Users cannot work around this on their end - this requires n8n's backend team to:

Verify the Google Cloud OAuth app configuration
Ensure all n8n Cloud instance domains are registered as valid redirect URIs
Redeploy or restart the credential authentication service

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions