emailRedirectTo parameter not working - Supabase ignoring custom redirect urls
Hi! I'm having an issue with Supabase auth where the emailRedirectTo parameter is being ignored. I'm trying to separate domains for early access domain vs development.
Problem:
I set
emailRedirectTo: 'https://mydomain.com/auth/callback'
in supabase.auth.signUp()
But confirmation emails still redirect to the Site URL from my dashboard
The redirect_to in the email link shows my dashboard Site URL, not my custom one
What I've tried:
- Set emailRedirectTo parameter correctly
- Verified the parameter is being passed
- Checked that the URL is valid
Expected behavior:
Email confirmations should redirect to my custom emailRedirectTo URL, not override with the dashboard Site URL
Thanks for any help 🙂15 Replies
You don't mention setting the valid redirect URLs in the dashboard.
I have added the early access domain to Redirect Urls in the dashboard.
The domain or the entire URL?
https://early.mydomain.com/auth/callback
is this correct?
If that exactly matches what is in your options:emailRedirectTo setting for signUp.
In my signUp options, I'm setting: emailRedirectTo: 'https://early.mydomain.com/auth/callback?redirect=/early-access/success' /early-access/success is also added to redirect urls
That won't be a match.
Why are you doing a "double" redirect versus redirecting right to early-access/success?
sorry, this is added as redirect url: https://early.mydomain.com/early-access/success
No idea what you are doing now.
Then your redirectTo in signUp should be https://early.mydomain.com/early-access/success
Are you using NextJS or a SSR framework? if yes then the
/auth/callback
is necessary.@silentworks nextjs yes. @garyaustin thanks, i'll give it a try now
And I'm going to assume you are using
@supabase/ssr
in your code?Seems like the
?redirect=/early..."
was ruining the flow. Removing it works 🙂 ThanksMove that to the email template instead. You can see an example here https://supabase.com/docs/guides/auth/passwords?queryGroups=language&language=js&queryGroups=flow&flow=pkce in the docs
Thanks, its working nice now 🙂