Short answer: passwordless phone login needs backend-owned SMS OTP resend cooldowns, maximum verification attempts, and daily caps per phone, IP, and device. For a media publisher, keep those controls separate from the instruction to send an order receipt after payment settles. Recovering a reader's access must never authorize another receipt.
The experiment's acceptance target is simple: a resend after a failed verification preserves the failed-attempt count and receipt eligibility. This is a proposed acceptance test, not a measured delivery result. It changes how integration effort should be counted: include the support actions a team must safely expose after the happy-path demo works.
A single “send again” handler looks attractive in a notebook. It can route a support request to whichever message the reader last received. But that shortcut mixes two kinds of authority: permission to deliver another authentication code and evidence that a payment settled. Choose explicit commands instead. The extra dispatch logic buys a much clearer support contract, especially when an agent helps interpret a reader's request.
Keep authority explicit.
What may an SMS OTP resend change in passwordless phone login?
Only the delivery-related state that the backend authorizes. A reader who has mistyped a code must not get a fresh verification budget by clicking resend. A refreshed browser must not reset the clock. And a support assistant must not turn “I can't get in” into a receipt-send instruction merely because both tasks involve messaging.
Implement send-code, verify-code, resend-code, and lockout states explicitly in the auth API. The backend owns expiry, attempt counters, increasing resend cooldowns, and daily send caps per phone, IP, and device. Check suppression before sending. Keep the stored auth state minimal; the client can display a countdown, but cannot supply the authoritative clock or counters. A device identifier is an abuse-policy input, so test the policy against identifier changes and shared IP addresses rather than assuming either identifies a person.
This matters for an Express application on Node.js handling food delivery courier login too. Its handlers need the same explicit states.
Here, the concrete system is a publisher selling a digital magazine issue: phone access gets the reader into the account, while a trusted settlement event makes the receipt eligible. Neither an OTP nor an agent's interpretation establishes payment status.
There are two retries to distinguish. A transport retry repeats the same authorized operation and keeps its operation identity. A deliberate resend requests a new operation and must pass admission again. Use the provider's documented idempotency contract where supported; check HTTP status, surface actual errors, and back off on HTTP 429 while honoring Retry-After. Never let transport retries silently replenish application send allowances.
Compare the support surface before choosing the delivery surface
The useful comparison starts with the work the publisher already needs. An email-only receipt adapter and a phone authentication adapter have different jobs. Combining them can reduce the number of integration contracts, but the application still owns authorization. That distinction is more useful than a ranking based on how quickly a sample sends its first message.
| Candidate | Integration starting point | Setup work to assess | Fit in this workflow | Selection boundary |
|---|---|---|---|---|
| Twilio | SMS documentation, including message segmentation | Test the actual OTP copy and connect backend admission controls | Phone-channel candidate | An SMS integration alone does not establish receipt eligibility |
| Amazon SES | Email sending documentation | Connect the settled-order event to an email adapter | Receipt-channel candidate | An email service does not complete phone login |
| Resend | Review the current email send contract | Validate receipt submission and duplicate-request handling | Another email receipt candidate | Assess phone authentication separately; this comparison makes no phone-verification claim |
| Infrai | One REST API covering 295 routes across 20 modules under one key | Map explicit application commands onto a consistent contract | Receipts, hosted SMS OTP, and additional backend capabilities | Delivery events use polling; geographic admission and country-spend circuit breakers belong in application policy |
The broad surface in the final row is useful when adding a supported capability means one more endpoint under the same conventions rather than another integration. Public, self-describing request and response schemas provide a separate advantage: a Python contract check can inspect the delivery boundary before connecting the support tool. These are concrete integration benefits, without a measured claim about implementation time.
Specialists remain sensible choices.
For an existing email-only receipt path, start by assessing SES or Resend rather than expanding the project to include unrelated capabilities. For phone messaging, Twilio's GSM-7 and UCS-2 segmentation documentation gives a specific copy-level check to carry into acceptance testing. Compare actual requirements, not product categories that happen to share a messaging label.
Scope matters here. With a polling-based delivery contract, select a polling cadence that meets the support screen's freshness requirement. Treat email-code recovery as application-owned verification logic. If SMTP relay, voice, WhatsApp, or RCS is a requirement, select a contract explicitly covering that channel. Domestic sending eligibility needs its own compliance review; breadth alone is not evidence for it.
A small command experiment makes the handoff inspectable
Here is the focused notebook-to-prod step: model what a support command may change before connecting a delivery adapter. The following Python 3 example uses only the standard library. It performs no network calls, verifies no real codes, and sends no receipts. The identifiers and limits are illustrative application fixtures, not provider fields or defaults.
from dataclasses import dataclass @dataclass class ReaderCase: order_id: str settled: bool = False receipt_reserved: bool = False failed_attempts: int = 0 sends: int = 1 next_send_at: int = 30 expires_at: int = 300 def request_resend(self, now, suppressed, daily_admitted): if now >= self.expires_at: return "expired" if self.failed_attempts >= 5: return "locked" if suppressed: return "suppressed" if now < self.next_send_at: return "cooldown" if not daily_admitted: return "daily_cap" self.next_send_at = now + 30 * (2 ** min(self.sends, 3)) self.sends += 1 return "reserve_otp_delivery" def request_receipt(self): if not self.settled: return "await_settlement" if self.receipt_reserved: return "already_reserved" self.receipt_reserved = True return "reserve_receipt_delivery" case = ReaderCase(order_id="magazine-order-231", failed_attempts=2) assert case.request_receipt() == "await_settlement" assert case.request_resend(29, False, True) == "cooldown" before = (case.failed_attempts, case.expires_at, case.receipt_reserved) assert case.request_resend(30, False, True) == "reserve_otp_delivery" assert before == (case.failed_attempts, case.expires_at, case.receipt_reserved) assert case.next_send_at == 90 assert case.request_resend(90, False, False) == "daily_cap" assert case.request_resend(90, True, True) == "suppressed" case.failed_attempts = 5 assert case.request_resend(90, False, True) == "locked" case.settled = True assert case.request_receipt() == "reserve_receipt_delivery" assert case.request_receipt() == "already_reserved" print(case.order_id, "command invariants passed") The important assertion spans three fields. The authorized resend changes neither failed attempts nor expiry nor receipt reservation. The 30-second initial wait and 5-attempt lock are test settings; tune them through abuse and usability testing. The second wait becomes 60 seconds. None of these assertions establish carrier delivery performance.
This is a command-level experiment, not a production authentication implementation. In production, calculate daily_admitted from server records and reserve the phone, IP, and device allowances atomically with the resend transition. Never accept that Boolean from the browser. The receipt reservation must likewise become a durable, atomic record coupled to a recoverable delivery job, so a process exit between reservation and submission cannot lose the work. Repeated trusted settlement events must find the same reservation. The in-memory flag only exposes the intended decision. Consider an operator clicking resend while a reader clicks it too: both requests must compete for the same allowance, and only an admitted request may create a delivery job. The support tool cannot get a separate budget merely because its request came through another screen.
One useful trap to test is a new challenge after lockout. Challenge-local verification attempts and phone-wide send limits have different lifetimes; creating a challenge must not create a fresh daily phone allowance. Define expiry and reset rules on the server, and exercise them with controlled time rather than waiting for a real countdown.
That is a productive eval-driven loop. Assertions make the permissions visible before any SMS is sent.
Pair that auxiliary fixture with a real, read-only contract request before implementing the delivery adapter. The Python example below retrieves the hosted OTP discovery schema. Install requests, set INFRAI_API_BASE to the service's documented versioned API base in trusted configuration, and set INFRAI_API_KEY in the environment. Discovery is public; the credential header demonstrates the adapter's authentication convention. No delivery is attempted.
import os import time from email.utils import parsedate_to_datetime import requests base = os.environ["INFRAI_API_BASE"].rstrip("/") headers = {"Authorization": "Bearer " + os.environ["INFRAI_API_KEY"]} for attempt in range(4): response = requests.request( method="GET", url=base + "/discovery/sms.otp", headers=headers, timeout=20, ) if response.status_code == 429 and attempt < 3: delay = float(2 ** attempt) retry_after = response.headers.get("Retry-After") if retry_after: try: delay = max(delay, float(retry_after)) except ValueError: retry_at = parsedate_to_datetime(retry_after).timestamp() delay = max(delay, retry_at - time.time()) time.sleep(delay) continue if not response.ok: raise RuntimeError(f"HTTP {response.status_code}: {response.text}") print(response.json()) break Inspect the request and response schemas before wiring send-code or verify-code. This checks contract access only; it does not prove message delivery or validate the application's anti-abuse policy.
Measure the handoff before copying the choice
An agent can classify a support message or help draft receipt copy. Give deterministic backend commands the final say on settlement, suppression, expiry, attempts, and send admission. This is prompt-cost aware: no model call is needed to increment a counter, compare a timestamp, or decide whether a payment event is trusted. Keep phone numbers and OTP values out of support-model prompts unless the workflow has a justified need for them.
Before selecting an adapter, measure the engineering work needed to make those commands safe under two simultaneous resend requests, a repeated settlement event, and a worker restart after reservation. Inspect denied-send counts by reason, time spent waiting for delivery-status polling, and how often support needs to escalate an expired or locked challenge. These are proposed measurements, not reported results. They expose integration effort that a successful first send hides.
Then test the human boundary. Can a support operator request an OTP resend without gaining a receipt-send capability? Does the screen explain a cooldown without offering an override that resets attempts? A small, clear command surface is easier to review than a generic messaging tool with broad authority, although it takes more deliberate wiring at the start. Copy the provider choice only after that trade-off fits the publisher's support workflow.
References
The following sources support the channel comparison and the specific SMS copy check. Review each sending contract for the selected deployment; this experiment does not claim an end-to-end provider benchmark.
- Amazon SES documentation: https://docs.aws.amazon.com/ses/latest/dg/Welcome.html
- Twilio SMS character limits and segmentation: https://www.twilio.com/docs/glossary/what-sms-character-limit
- Resend email sending reference: https://resend.com/docs/api-reference/emails/send-email
