S
Supabase•20h ago
szy

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
garyaustin
garyaustin•20h ago
You don't mention setting the valid redirect URLs in the dashboard.
szy
szyOP•20h ago
I have added the early access domain to Redirect Urls in the dashboard.
garyaustin
garyaustin•20h ago
The domain or the entire URL?
szy
szyOP•20h ago
garyaustin
garyaustin•20h ago
If that exactly matches what is in your options:emailRedirectTo setting for signUp.
szy
szyOP•20h ago
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
garyaustin
garyaustin•20h ago
That won't be a match. Why are you doing a "double" redirect versus redirecting right to early-access/success?
szy
szyOP•20h ago
sorry, this is added as redirect url: https://early.mydomain.com/early-access/success
garyaustin
garyaustin•20h ago
No idea what you are doing now. Then your redirectTo in signUp should be https://early.mydomain.com/early-access/success
silentworks
silentworks•20h ago
Are you using NextJS or a SSR framework? if yes then the /auth/callback is necessary.
szy
szyOP•20h ago
@silentworks nextjs yes. @garyaustin thanks, i'll give it a try now
silentworks
silentworks•20h ago
And I'm going to assume you are using @supabase/ssr in your code?
szy
szyOP•20h ago
Seems like the ?redirect=/early..." was ruining the flow. Removing it works 🙂 Thanks
silentworks
silentworks•20h ago
Move 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
szy
szyOP•20h ago
Thanks, its working nice now 🙂

Did you find this page helpful?