Two things are sending you to production:
NEXT_PUBLIC_SITE_URLis probably set for all environments in Vercel, so previews also say 'go back to prod'. Set it for Production only and on previews fall back to the current origin:
const origin = typeof window !== 'undefined'
? window.location.origin
: process.env.NEXT_PUBLIC_SITE_URL
await supabase.auth.signInWithOAuth({
provider: 'google',
options: { redirectTo: `${origin}/auth/callback` },
})- Supabase must allow the preview URLs. Redirect URLs support wildcards, so add:
https://*-your-team-slug.vercel.app/**
If a redirect isn't on the list, Supabase falls back to the Site URL, which is your production domain.