DEV Community

2020byte
2020byte

Posted on

How to change the redirect URL when changing a user's email in Supabase?

I have implemented a feature in Supabase where authenticated users can change their email using updateUser. The email change works well, but I want to change the redirect URL that users reach when they click the verification link sent to the new email address. I've searched through the official documentation, but I can't find anything. It seems like an essential feature. If anyone knows how to do this, I would really appreciate your help. Thank you!

Top comments (2)

Collapse
 
sohanemon profile image
Sohanur Rahman Emon

If anyone is still looking for this:

      const { error } = await supabase.auth.updateUser(
        { email },
        {
          emailRedirectTo: `/auth/callback?next=${encodeURIComponent(`/auth/email-updated?new_email=${email}`)}`
        },
      );
Enter fullscreen mode Exit fullscreen mode
Collapse
 
glitterangle profile image
Glitter Angle (i know it's not angel)

Did you ever figure this out? If not let me know I just figured it out myself this evening