Engineering

OTP Sign-In UX: Expiry, Resend Limits and Account Recovery

Specify OTP delivery, resend, expiry and approved recovery with server-enforced rules and usable code entry.

Purushottam Kumar Suman
Purushottam Kumar Suman
Founder & CEO, Drema AI
2 min read
Smartphone screen showing a grid of colourful app icons

OTP sign-in needs clear delivery, expiry, resend and verification states, with controls enforced on the server. A message being dispatched does not prove the user received it. Design the failure and recovery journey without exposing whether an unrelated account exists or encouraging repeated code requests.

CTA Background

Let’s plan your OTP sign-in flow.

Bring your workflow, constraints and open questions. We’ll help you define the requirements and work through a practical next step.

01

Choose the authentication scope deliberately

Have the security owner select the authentication method appropriate to the product and its risks. SMS or email codes are not interchangeable with every stronger authentication method, and possession of a contact channel should not automatically merge existing accounts.

OWASP's authentication guidance addresses generic error responses, automated-attack controls and account recovery. Apply the relevant controls through the identity provider and application, not merely the visible countdown.

02

Specify the code lifecycle

EventUser explanationServer-side rule to agree
Request acceptedWhere the code is expectedEligibility and rate controls
Delivery delayedUseful waiting and correction optionsProvider failure handling
Resend requestedWhich code remains validInvalidation and resend policy
Incorrect codeClear recoverable errorAttempt limits and monitoring
Code expiredRequest a valid new attemptAuthoritative expiry check
Contact unavailableApproved recovery routeIdentity verification process

Do not invent a universal code duration or attempt count. Select and document values through the approved security design and provider capabilities.

03

Avoid a confusing resend race

For a hypothetical customer app, a user may request a second code just before the first arrives. Explain which attempt they should use and enforce the same rule consistently. Client clocks should not determine whether a code is valid.

Support correction of a mistyped contact destination without carrying an earlier code into the new identity context. Do not expose codes in analytics, screenshots generated for support or general logs.

04

Test assistive and interrupted entry

Verify paste, autofill where supported, keyboard interaction and readable errors. Multiple visual boxes should not make entering a code unnecessarily difficult.

Test app switching, connectivity loss and a provider outage. A failed verification request must not be presented as an incorrect code if the server never completed the check.

05

OTP questions

Does a countdown enforce expiry?

No. It communicates timing; the server or trusted identity service must enforce the actual rule.

Should support simply change the contact number on request?

Use the approved recovery and verification process. A convenient support shortcut can undermine the sign-in boundary.

Connect sign-in to session recovery, and discuss the flow with Drema's mobile team.

Sources · last reviewed November 1, 2026

This article explains what to build, not legal advice. Rules change; confirm against the current official text before relying on it.

Purushottam Kumar Suman
Written by
Purushottam Kumar Suman
Founder & CEO, Drema AI

Founder and CEO of Drema AI. Builds AI systems, SaaS platforms and industry software — and writes about what actually survives production.

CTA Background

Got a problem like this one?

Bring it to a call with a founder.You will get a straight answer, including when the answer is no.

View Our Work
AI-First Engineering
Secure & Scalable
Built to Deliver Impact