© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
36 replies
Hanan

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
AuthApiError: Verify requires either a token or a token hash
, tried converting the pin to strings and using
token_hash
token_hash
instead of
token
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 
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('/')
      }
    }
  } 
 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
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

I want to use Custom sms provider when doing registration with phone verifying otp
SupabaseSSupabase / help-and-questions
8mo ago
Need help with otp\disabled (Magic-link / OTP)
SupabaseSSupabase / help-and-questions
8mo ago
Login with Email & OTP
SupabaseSSupabase / help-and-questions
7mo ago
Expo with login with email OTP
SupabaseSSupabase / help-and-questions
3y ago