Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseβ€’3mo agoβ€’
44 replies
Nubartis

Getting otp_expired error when running verifyOtp

auth
Hi everyone!

I've been hitting my head on a wall when trying to understand why this happens:

I have created a password less 6 digit login flow for both new users and existing ones following what I think is the right approach.

1. Users enter their email addresses and click a button, the following is executed in my client code:
supabaseClient.auth.signInWithOtp({ email });
supabaseClient.auth.signInWithOtp({ email });

2. They correctly get created if not existing
3. They correctly receive an email with a 6 digit token
4. Then they introduce it and the following is executed
 const { error, data } = await supabaseClient.auth.verifyOtp({
        email: 'johndoe@gmail.com',
        token: '123456',
        type: 'email',
    });
 const { error, data } = await supabaseClient.auth.verifyOtp({
        email: 'johndoe@gmail.com',
        token: '123456',
        type: 'email',
    });

5. This returns always

{"code":"otp_expired","message":"Token has expired or is invalid"}
{"code":"otp_expired","message":"Token has expired or is invalid"}


I can't see in the logs any explanation about the reason of this expiry or invalidity so I find myself completely unable to trace the cause of this. I know it must be something I am missing but I am really in the dark here πŸ˜…

Can someone lend me a hand? Many, many thanks in advance!
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

getting an error with verifyOtp
SupabaseSSupabase / help-and-questions
3y ago
Auth β€œSend SMS” Hook: /otp fails with missing auth.otp_attempts β†’ verifyOtp β€œtoken expired or invali
SupabaseSSupabase / help-and-questions
5mo ago
OTP Expired or Invalid
SupabaseSSupabase / help-and-questions
17mo ago
verifyOtp 401 error
SupabaseSSupabase / help-and-questions
4y ago