Skip to Content
🚀 SpaceDF v2025.12.19 is now live! Read the release notes
TroubleshootingIssuesGoogle OAuth: redirect_uri_mismatch

Google OAuth: redirect_uri_mismatch

This error occurs when the redirect URI used by SpaceDF does not exactly match the Authorized Redirect URI configured in the Google Cloud Console.

Symptoms

Google shows an error page with:

Error 400: redirect_uri_mismatch

Google login works in one environment (local or production) but fails in another.

The login flow redirects to Google, then immediately fails.

Common causes (SpaceDF-specific)

  • GOOGLE_CALLBACK_URL in .env does not match the redirect URI configured in Google Cloud Console.
  • The redirect URI is correct, but:
    • Protocol is different (http vs https)
    • Port is different (3000 vs 80)
    • Trailing slash mismatch
  • Production domain is not added to Google OAuth settings.
  • Switching from Quick Start to Advanced Setup without updating OAuth settings.

Fix

Verify GOOGLE_CALLBACK_URL

Check your .env file:

# Development GOOGLE_CALLBACK_URL=http://localhost:3000 # Production GOOGLE_CALLBACK_URL=https://your-domain.com

Do not include /auth/google/callback in GOOGLE_CALLBACK_URL SpaceDF appends it automatically.

Update Google Cloud Console

2

Navigate to APIs & Services → Credentials

3

Select your OAuth 2.0 Client ID.

4

Under Authorized redirect URIs, add:

# Development http://localhost:3000/auth/google/callback # Production https://your-domain.com/auth/google/callback

The URI must match exactly, including protocol, domain, port, and path.

Restart SpaceDF services

After updating .env, restart all services:

docker compose down docker compose up -d

Common mistakes to avoid

    ❌ Using localhost in production
    ❌ Mixing HTTP and HTTPS
    ❌ Missing the /auth/google/callback path in Google Console
    ❌ Adding trailing slashes inconsistently
    ❌ Forgetting to restart services after changing .env

Notes

  • Google OAuth is not enabled in Quick Start.
  • This error only applies when using Advanced Setup.
  • Each environment (local, staging, production) requires its own redirect URI entry.
Last updated on