Google OAuth "Bad request" error on local development with Supabase CLI
I'm getting a "Bad request" error when trying to authenticate with Google OAuth using local Supabase development. The OAuth flow starts correctly, but fails when redirecting back to the Supabase auth endpoint. On cloud works just fine!
What I'm trying to achieve:
Set up Google OAuth authentication in a Next.js app using local Supabase development
User should be able to sign in with Google and be redirected back to the app
What's going wrong:
Google OAuth consent screen does not appear
When redirecting to http://127.0.0.1:54321/auth/v1/authorize?provider=google&code_challenge=..., I get:
Environment details:
OS: Linux (Ubuntu)
Framework: Next.js 15+ with App Router
Platform: Web
Library: @supabase/ssr (latest), @supabase/supabase-js (latest)
Supabase CLI: local development (npx supabase)
Configuration tested:
Google Cloud Console redirect URI: http://127.0.0.1:54321/auth/v1/callback
Environment variables are correctly loaded in the auth container:
GOTRUE_EXTERNAL_GOOGLE_CLIENT_ID:
correct
GOTRUE_EXTERNAL_GOOGLE_SECRET:
correct
GOTRUE_EXTERNAL_GOOGLE_REDIRECT_URI:
matches Google Console
Supabase config.toml:
Next.js Server Action:
Has anyone encountered this specific "Bad request" error with Google OAuth in local Supabase development? Any insights would be greatly appreciated!
What I'm trying to achieve:
Set up Google OAuth authentication in a Next.js app using local Supabase development
User should be able to sign in with Google and be redirected back to the app
What's going wrong:
Google OAuth consent screen does not appear
When redirecting to http://127.0.0.1:54321/auth/v1/authorize?provider=google&code_challenge=..., I get:
Environment details:
OS: Linux (Ubuntu)
Framework: Next.js 15+ with App Router
Platform: Web
Library: @supabase/ssr (latest), @supabase/supabase-js (latest)
Supabase CLI: local development (npx supabase)
Configuration tested:
Google Cloud Console redirect URI: http://127.0.0.1:54321/auth/v1/callback
Environment variables are correctly loaded in the auth container:
GOTRUE_EXTERNAL_GOOGLE_CLIENT_ID:
GOTRUE_EXTERNAL_GOOGLE_SECRET:
GOTRUE_EXTERNAL_GOOGLE_REDIRECT_URI:
Supabase config.toml:
Next.js Server Action:
Has anyone encountered this specific "Bad request" error with Google OAuth in local Supabase development? Any insights would be greatly appreciated!