Skip to Content
๐Ÿš€ SpaceDF v2025.12.19 is now live! Read the release notes
TroubleshootingIssuesGoogle OAuth: redirect_uri_mismatch

Google OAuth: redirect_uri_mismatch

The Problem: The URL that SpaceDF sends to Google does not exactly match the URL you allowed in the Google Cloud Console.

1. The Golden Rule

To fix this, you must understand how SpaceDF constructs the URL.

LocationConfig NameValue FormatExample
Your Server (.env)GOOGLE_CALLBACK_URLBase Domain Onlyhttps://your-domain.com
Google ConsoleAuthorized Redirect URIFull Pathhttps://your-domain.com/auth/google/callback

โš ๏ธ Crucial Difference

    SpaceDF automatically appends /auth/google/callback to your .env value.
    ๐Ÿ‘‰ Do NOT add the path in your .env file.
    ๐Ÿ‘‰ DO add the path in Google Console.

2. Step-by-Step Fix

Check your .env file

Open your .env file and ensure GOOGLE_CALLBACK_URL contains only the protocol and domain (and port if local).

# โœ… CORRECT (Base URL only) GOOGLE_CALLBACK_URL=[https://your-domain.com](https://your-domain.com) # โŒ INCORRECT (Do not add the path here) GOOGLE_CALLBACK_URL=[https://your-domain.com/auth/google/callback](https://your-domain.com/auth/google/callback)

Update Google Cloud Console

Please follow Google Oauth Guide in the Advanced Setup section

Restart Services

Environment variables are only loaded when the container starts.

docker compose down docker compose up -d

3. Common Mistakes Checklist

๐Ÿ“ Troubleshooting Checklist

    • Protocol: Did you write http in .env but https in Google Console? (Must match).
    • Trailing Slash: Did you put https://site.com/ in .env? (Remove the trailing slash).
    • Port: Are you using port 80 or 443 but explicitely wrote :3000?
    • Environment: Did you configure the Production URL but are trying to log in from Localhost? (You need both entries in Google Console).
Last updated on