Next.JS + supabase + google oauth sign in : In production with custom domain always redirects to error page later works fine #83773
Unanswered
mailtosravan2024-del
asked this question in
Help
Replies: 1 comment
-
|
Hello! This is a common OAuth configuration issue with custom domains. The problem typically occurs due to redirect URI mismatches between your Supabase configuration and production environment. Solution: Update Supabase Redirect URLs
https://yourcustomdomain.com
https://yourcustomdomain.com/auth/callback
https://yourcustomdomain.com/api/auth/callback
https://yourcustomdomain.com/auth/confirm
NEXT_PUBLIC_SITE_URL=https://yourcustomdomain.com
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
export const { auth } = createClient({
supabaseUrl: process.env.NEXT_PUBLIC_SUPABASE_URL,
supabaseKey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
options: {
auth: {
flowType: 'pkce',
autoRefreshToken: true,
detectSessionInUrl: true,
persistSession: true,
},
},
})
The initial error occurs because Supabase redirects to the configured URL, which doesn't match your custom domain until the configuration is updated. Once corrected, subsequent attempts should work seamlessly. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Beta Was this translation helpful? Give feedback.
All reactions