Redirect URLs
Understanding and configuring OAuth redirect URLs in Supascale.
Redirect URLs (also called callback URLs) are a critical part of OAuth authentication. This guide explains how they work and how to configure them correctly.
How OAuth Redirects Work
- User clicks "Sign in with Google" (or other provider)
- User is redirected to the provider's login page
- After authentication, provider redirects back to your callback URL
- Supabase processes the callback and creates/signs in the user
- User is redirected to your application
Callback URL Format
Supascale uses Supabase's standard callback endpoint:
http://your-domain:API_PORT/auth/v1/callback
For example, if your API runs on port 54321:
http://localhost:54321/auth/v1/callback
Or with a custom domain:
https://api.yourapp.com/auth/v1/callback
Finding Your Callback URL
- Go to your project in Supascale
- Navigate to Settings > Auth Providers
- Click on any provider
- The callback URL is displayed in the configuration dialog
- Use the copy button to copy it exactly
Configuring in Provider Consoles
Each OAuth provider has a different interface, but the general steps are:
- Go to Google Cloud Console
- Select your project
- Navigate to APIs & Services > Credentials
- Click on your OAuth 2.0 Client ID
- Under Authorized redirect URIs, add your callback URL
GitHub
- Go to GitHub Developer Settings
- Select your OAuth App
- In Authorization callback URL, enter your callback URL
Discord
- Go to Discord Developer Portal
- Select your application
- Navigate to OAuth2 > General
- Add your callback URL under Redirects
Site URL and Additional Redirects
Beyond the OAuth callback, you also need to configure:
Site URL
The main URL of your application. This is where users are redirected after authentication.
- Go to Settings > Authentication
- Set the Site URL field
Additional Redirect URLs
If your app runs on multiple domains or you need to support multiple redirect destinations:
- Go to Settings > Authentication
- Add URLs to Additional Redirect URLs (comma-separated)
Example:
http://localhost:3000,https://staging.yourapp.com,https://yourapp.com
Common Issues
Redirect URI Mismatch
Error: "redirect_uri_mismatch" or "Invalid redirect URI"
Solution:
- Ensure the URL in the provider console matches exactly
- Check for trailing slashes
- Verify the port number is correct
- Ensure protocol (http/https) matches
HTTPS Requirements
Some providers (like Google, Facebook) require HTTPS redirect URLs in production:
- Use a reverse proxy (nginx, Caddy) with SSL
- Configure Let's Encrypt certificates in Supascale
- See SSL Certificates for setup
Localhost Issues
For local development:
- Use
http://localhost:PORT(not127.0.0.1) - Some providers have special handling for localhost
- Google allows localhost without HTTPS
Best Practices
- Always use HTTPS in production - Required by most providers and essential for security
- Use exact URLs - No wildcards in redirect URLs
- Update when domains change - Update both Supascale and provider console
- Test after configuration - Always test the full authentication flow