auth-js icon indicating copy to clipboard operation
auth-js copied to clipboard

merge verifyOtp() email types into one

Open hjaber opened this issue 3 years ago • 0 comments

Feature request

verifyOtp() takes a type parameter upon verifying the 6 digit otp. I am requesting to merge many of the email types into one.

signup, magiclink, and invite --> email

This would prevent things such as determining if a user has already signed up on on the sign in page or vice versa on the log in page.

Initially brought up by @Olyno on discussion #8451

Is your feature request related to a problem? Please describe.

New users can bypass sign up by requesting a code twice: if you verifyOtp({ email, token, type: 'magiclink"}) for a new user, the code will fail as the method did not utilize type: 'signup'. However, if the the same new user tries to login again using the same verifyOtp({ email, token, type: 'magiclink"}), the code will now work treating the user as an already existing user despite being a new user.

Describe the solution you'd like

- signup
- invite
- magiclink
+ email
 recovery
email_change
sms
phone_change

Describe alternatives you've considered

As @Olyno mentioned on discussion #8451 that they would like to see signup and magiclink be combined into email and I'd also be happy with that compared to the current state.

Additional context

There is no additional options such as redirects with verifyOtp() so any kind of auth flow for recovery or signup onboarding must be done on the frontend with javascript anyway.

current:

const { data, error } = await supabase.auth.verifyOtp({
  email,
  token,
  type: 'signup',
})

future:

const { data, error } = await supabase.auth.verifyOtp({
  email,
  token,
  type: 'email',
})

supabase/supabase-js v2.0.0-rc.10 supabase/go-js v2.0.0-rc.4

Thank You.

hjaber avatar Sep 10 '22 21:09 hjaber