How to Build Node.js SMS OTP Login Without Webhooks Using Polling
A developer has outlined a polling-based approach to SMS OTP authentication in Node.js that avoids relying on webhook callbacks from the provider. In this design, the auth service manages a server-side challenge record and returns only an opaque challenge ID to the browser, keeping provider credentials hidden from the client. Three separate controls — code expiry, resend cooldown, and polling interval — are maintained independently to prevent unintended interactions such as a resend accidentally extending a session. Abuse prevention is handled at the application layer, covering per-account, per-IP, and per-device limits that the SMS provider cannot enforce on its own. The author notes that a surprise $214 bill on a past project, caused by a broken client loop, underscored the importance of strict polling limits and storing only challenge IDs rather than phone numbers in worker logs.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in