© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
29 replies
FuyouQ

auth.signUp and auth.signIn gives same otp every time and fail to verifyOtp

I am implementing email auth. At first I signup a user by email, and received otp, the verifyotp worked, user become verified and can login by password. then I was to test passwordless(otp) signin by email, it always give me same otp and always fail to verify otp (error says 'Token has expired or is invalid') no matter how many times I call the auth.signIn and pass in the token in verifyOtp.

I then deleted the user from supabase authentication users and want to try signup again. Then same error happens, every signup gives me same otp and fails to verify.

My implementations
// signUp
    const { data, error } = await this._client.auth.signUp({
      phone: mobile,
      password: password,
    });
// email sign in with otp
    const { data, error } = await this._client.auth.signInWithOtp({
      email: email,
      options: {
        shouldCreateUser: false,
      },
    });
// verify otp
    const { data, error } = await this._client.auth.verifyOtp({
      email: email,
      token: code,
      type: 'email',
    });
// signUp
    const { data, error } = await this._client.auth.signUp({
      phone: mobile,
      password: password,
    });
// email sign in with otp
    const { data, error } = await this._client.auth.signInWithOtp({
      email: email,
      options: {
        shouldCreateUser: false,
      },
    });
// verify otp
    const { data, error } = await this._client.auth.verifyOtp({
      email: email,
      token: code,
      type: 'email',
    });
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

Issues setting up OTP code signin and signup flows
SupabaseSSupabase / help-and-questions
4y ago
Auth “Send SMS” Hook: /otp fails with missing auth.otp_attempts → verifyOtp “token expired or invali
SupabaseSSupabase / help-and-questions
5mo ago
cannot signin after signup
SupabaseSSupabase / help-and-questions
13mo ago
Getting otp_expired error when running verifyOtp
SupabaseSSupabase / help-and-questions
3mo ago