Error with verifying through OTP

The code sends the otp numbers to certain emails but I till get AuthApiError: Verify requires either a token or a token hash , tried converting the pin to strings and using token_hash instead of token but still getting the same error. These are the errors and this is the code. Note: All e-mails and passwords are valid and the functions which check them return true statements



const handleVerify = async () => { const { data, error } = await supabase.auth.verifyOtp({ email:email, token_hash:pin, type: 'email'}) <---- Line 94 console.log(data.session) console.log(email) console.log(isEmailValid) if (error) { console.log(error); <------- Line 100 setErrorMessage(error.message); } else{ const {data : {user}} = await supabase.auth.getUser() if (user?.email_confirmed_at) { router.push('/') } } }
image.png
Was this page helpful?