VerifyOtp() 401 error but verified user being created in Supabase without verification
I'm noticing weird behaviour with my app with regards to the verifyOtp() function.
STACK:
Next.js
React Hook Form (for accepting user input)
USE CASE:
I'm creating a sign-up wizard, where the user is prompted for their email, which then gets sent a verification code. I then take the user to a page where they enter the OTP received. Upon successfully verifiying their email with OTP, they should be directed to a "Complete Your Profile" page
The code for this function is here:
The email with the verification code gets sent successfully, but I notice that a verified user is created in supabase, before verifying the OTP. This is problem 1 and I am not sure what's going wrong.
The second problem is a 401 error is returned when calling the verifyOtp function on the subsequent page.
The code for this function is here:
STACK:
Next.js
React Hook Form (for accepting user input)
USE CASE:
I'm creating a sign-up wizard, where the user is prompted for their email, which then gets sent a verification code. I then take the user to a page where they enter the OTP received. Upon successfully verifiying their email with OTP, they should be directed to a "Complete Your Profile" page
The code for this function is here:
The email with the verification code gets sent successfully, but I notice that a verified user is created in supabase, before verifying the OTP. This is problem 1 and I am not sure what's going wrong.
The second problem is a 401 error is returned when calling the verifyOtp function on the subsequent page.
The code for this function is here: