Error library

Symptom: auth breaks on custom domain: Supabase Auth / Clerk redirect and cookie mismatch

The auth provider is still configured for your old origin, so it redirects to localhost or sets cookies for a domain your app no longer uses. In Supabase, set the Site URL and Redirect URLs to your custom domain; in Clerk, create a production instance for that domain and add its DNS records.

Get this exact error fixed — $49 Quick FixFixed within scope, or we keep working until it is · Read-only access Not sure it's this error? $149 diagnosis

Cause: Site URL / allowed redirect URLs / production domain still point at localhost or the preview domain.

How to fix it

  1. Supabase: Authentication > URL Configuration: set Site URL to https://yourdomain.com and add production redirect URLs.
  2. Pass redirectTo that matches an allowed URL (e.g. window.location.origin).
  3. Clerk: create a production instance, add your domain and the DNS records Clerk shows, and use production keys.
  4. Update OAuth provider callback URLs and redeploy with the new env vars.

Example

Illustrative example, not from a customer project.

  // Supabase sign-in
  await supabase.auth.signInWithOAuth({
    provider: 'google',
-   options: { redirectTo: 'http://localhost:3000' },
+   options: { redirectTo: `${window.location.origin}/auth/callback` },
  })

FAQ

Why localhost specifically?

Supabase falls back to the Site URL, which defaults to localhost in new projects, when redirectTo isn't an allowed URL.

Can I use Clerk development keys in production?

Clerk's docs direct you to a production instance with your own domain for launch.

QUICK FIX · $49 · THIS ERROR ONLY

Get this exact error fixed — $49 Quick FixFixed within scope, or we keep working until it is · Read-only access Not sure it's this error? $149 diagnosis

One error, one root cause, fixed in your app. If it turns out bigger, we tell you before doing more, and your $49 is credited toward the fix, diagnosis or Launch Path if you book within 14 days. Fixing three? The 3-Error Pack is $119.

Bigger job: More than one auth or data issue? Auth & database security fix, from $400.

Built with Lovable, Bolt, Replit, Cursor or v0? See rescue by platform and the security checklist.

Check it yourself first, free

$49Fix this error