Issues setting up OTP code signin and signup flows

I'm trying to create a user flow where an OTP code is sent to users email and then verified to sign them in.

Following supabases documentation I am doing following

  1. I changed from using link in "Magic Link" email template to {{ .Token }}
  2. I tried using both type: 'magiclink' and type: 'signup' in code below
  3. My email provider settings are set to 60000 for expiry seconds and 6 for password length. Email confirmation is set to be enabled.
Implementation is as follows

const { data, error } = await supabaseClient.auth.signInWithOtp({ email })
// {"data": {"session": null, "user": null}, "error": null}

const { data, error } = await supabaseClient.auth.verifyOtp({ email, token, type: 'signup' })
// {"data": {"session": null, "user": null}, "error": [AuthApiError: Token has expired or is invalid]}


I double verified that token I am sending is exact one as I got in email, yet I keep getting that auth error.
Was this page helpful?