Problem with OTP Retry Feature in Email Authentication #12957
Unanswered
Abuhaithem
asked this question in
Help
Replies: 2 comments 1 reply
-
when I remove the
|
Beta Was this translation helpful? Give feedback.
0 replies
-
need help here please guys help me |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem with OTP Retry Feature in Email Authentication
I'm currently implementing an email-based authentication system using NextAuth.js with OTP (One-Time Password) verification. However, I encountered an issue where, after entering an incorrect OTP, I cannot retry the OTP verification. NextAuth.js currently allows only a single OTP verification attempt before blocking further submissions, which is problematic for situations where users might enter incorrect OTPs multiple times.
Here is a brief overview of the current code and setup I’m using:
Server-side Code (NextAuth.js Configuration)
Client-side Code (Email Verification Flow)
Authentication Code ("/lib/auth")
The Issue
NextAuth.js does not allow me to resend the OTP once an incorrect OTP is entered. I would like to be able to retry OTP verification multiple times. Currently, once a wrong OTP is entered, the system does not provide an easy way for the user to retry, which breaks the user experience.
Expected Behavior
After a failed OTP entry, I should be able to retry the verification and resend the OTP.
The system should support multiple OTP attempts, rather than blocking further submissions after one failure.
Steps to Reproduce
User enters an email for sign-in and receives an OTP.
User enters an incorrect OTP.
User cannot retry entering the OTP, and there is no option to resend it easily.
Potential Solution
From my research, I found a similar issue discussed on the NextAuth.js GitHub (Issue #709). The problem lies in the fact that NextAuth.js doesn't provide retry functionality for OTP verification once an incorrect OTP is entered.
It would be helpful if there was an option in NextAuth.js to either:
Allow multiple OTP attempts (without blocking retry).
Provide a clear method to trigger OTP resend functionality after an incorrect attempt.
I would like to request an enhancement or clarification on how to implement OTP retries within NextAuth.js, specifically for use cases like mine.
Additional Context
I'm using the next-auth OTP email provider.
Here’s a link to the issue I referenced: NextAuth Issue #709
I have implemented OTP retry functionality using a client-side button that triggers OTP resend.
Looking forward to your feedback on this! Thank you for your help.
Beta Was this translation helpful? Give feedback.
All reactions