| Option | Pick this when | Evidence to require before adoption |
|---|---|---|
| Plain REST with hosted SMS OTP and application-owned email fallback | A bounded polling workflow meets the signup requirement | A trace joining send attempts, status observations, fallback decisions, and successful verification |
| Twilio Verify | A dedicated verification service is the candidate under review | Test the proposed channel flow and review its retention terms |
| Amazon Cognito | User-pool authentication is the candidate under review | Establish which authentication events the application can retain and connect to signup |
| Auth0 | An identity platform is the candidate under review | Test the proposed factor configuration and the evidence exported for each transition |
| SendGrid | The evaluation concerns the email delivery leg | Verify message evidence separately from application-owned challenge validation |
| Postmark | Transactional email delivery is the selection boundary | Review the email integration without assuming it supplies the full login policy |
Deliver the signup verification link through an immediate email workflow, and keep the later SMS-to-email login recovery policy explicit. TL;DR: use hosted SMS OTP as the primary login factor; add email OTP fallback only when bounded status polling and application-owned code validation meet your requirements. For a healthtech SaaS serving US and EU users, make compliance evidence the selection axis: can a reviewer reconstruct the authorization decision without seeing the secret?
A signup link and a login OTP solve different jobs. Sending either message does not establish that the account has completed verification. This distinction should shape the logs before it shapes the dashboard.
How should SMS OTP login fallback to email preserve evidence?
Start small. A plain REST API lets a backend make HTTP requests without installing a vendor SDK or maintaining its client-library version. A Node.js application can keep HTTP integration separate from its 2FA policy. In practice, request metadata describe a call; they don't establish that a person verified an account.
Keep those boundaries visible.
Infrai uses a plain REST API with no SDK to install, plus one key, one wallet, and one bill for SMS and email. Anything that sends an HTTP request can call it, in any language. The signup-link sender and login recovery worker can share one credential integration instead of maintaining separate provider credentials for each channel. That reduces credential configuration and billing reconciliation work; the application still needs access controls around each worker. Its public, self-describing discovery surface also lets the team inspect request and response schemas without an API key before integrating. Pick this approach when your application can own the recovery state machine and tolerate pull-based status observations; choose a dedicated verification-service evaluation when that responsibility is outside your team's scope.
Treat polling as the integration contract: a delivery observation may arrive after the next user action, so it cannot be the sole authority for switching factors. Your application owns email-code issuance and validation. For authentication recovery, send immediately after an authorized transition, keeping scheduled messaging out of the recovery policy.
The shortest integration is not automatically the shortest audit. With the REST approach, the application must explain why a fallback became eligible, which earlier challenge stopped being acceptable, and what evidence completed the attempt. That can be a good trade when the team already owns authentication policy. It is a heavier responsibility when the team expects a provider to own the full identity lifecycle.
That's the trade-off.
Pick a verification service or an identity platform deliberately
Twilio Verify is a serious candidate when the evaluation starts with a dedicated verification service. Compare it against the application-owned flow at the challenge boundary: which component issues the challenge, checks the answer, and provides evidence of the outcome? Require a demonstration of the exact SMS and email recovery sequence before assuming that a product name answers those questions. Its verification documentation is the starting point, not proof that a particular healthtech configuration is approved.
Amazon Cognito is a different selection boundary: user-pool authentication. Pick it for evaluation when signup and login should be assessed together as an identity workflow. The trade is scope. Mapping an existing application policy into a user-pool design is a broader decision than replacing a message sender. Ask for an event trace that follows one signup into its later recovery attempt.
Auth0 belongs on the shortlist when the team wants to evaluate an identity platform and its factor configuration. Test the recovery path alongside the primary factor. An acceptable configuration needs to explain who may authorize a switch and which records your team can keep; a successful demo of the primary login screen does not answer either question.
These are three distinct product boundaries, not a delivery-speed ranking. Comparative latency, regional processing guarantees, and health-data contractual coverage need separate verification for each proposed deployment. Resolve those through the proposed configuration, documented data flows, and contractual review. Do that before treating US/EU availability as compliance evidence.
SendGrid and Postmark are additional email-delivery candidates, rather than substitutes for the complete authentication policy. Pick either for evaluation when the application will retain responsibility for challenge issuance and validation. Compare its documented message evidence and integration model against your retention needs. Their limitation in this comparison is scope: evaluating an email leg doesn't establish the safety of SMS-to-email recovery. Use the dedicated verification-service evaluation when that broader challenge boundary matters more than independently choosing an email sender.
Build the evidence trail before adding another channel
Diagram in words: signup request → application challenge → immediate verification-link send → user redemption → account verification. Later, a separate login attempt follows SMS challenge → bounded status observations → policy decision → immediate email challenge if eligible → successful validation. The arrows represent application transitions. They are not provider callbacks.
Keep the two workflows separate in the data model. An email address confirmed during signup is an input to the later recovery policy, not proof that every future email challenge is valid. Give each attempt an opaque identifier and each channel attempt its own identifier. Record the policy version that authorized a transition. Otherwise, a reviewer may see two delivered messages and still have no explanation for why the second factor was accepted.
Before: two send records and a successful login.
After: a signup confirmation, a versioned recovery decision, and a separately recorded challenge-validation result. Now a reviewer can ask why email was allowed, and the application has a specific answer.
First, inspect a real SMS status response without guessing its fields. Configure the documented HTTPS API origin in INFRAI_ORIGIN, the credential in INFRAI_API_KEY, and an existing message identifier in SMS_MESSAGE_ID. Keep this server-side. This read-only example retries HTTP 429 up to 3 times, honors a numeric or date-form Retry-After header, and surfaces other unsuccessful responses. It prints only the HTTP status and top-level field names. Run it with a TypeScript-capable runtime.
async function inspectSmsStatus() {
const origin = process.env.INFRAI_ORIGIN;
const key = process.env.INFRAI_API_KEY;
const id = process.env.SMS_MESSAGE_ID;
if (!origin || !key || !id) {
throw new Error("Set INFRAI_ORIGIN, INFRAI_API_KEY, and SMS_MESSAGE_ID");
}
const url = new URL(`/v1/sms/status/${encodeURIComponent(id)}`, origin);
if (url.protocol !== "https:") throw new Error("HTTPS is required");
for (let attempt = 0; attempt < 4; attempt++) {
const response = await fetch(url, {
method: "GET",
redirect: "error",
headers: { Authorization: `Bearer ${key}` },
signal: AbortSignal.timeout(10_000),
});
if (response.status === 429 && attempt < 3) {
const value = response.headers.get("Retry-After");
const seconds = value === null ? NaN : Number(value);
const retryMs = Number.isFinite(seconds)
? seconds * 1000
: value === null ? 0 : Date.parse(value) - Date.now();
const delayMs = Math.max(
1000 * 2 ** attempt,
Number.isFinite(retryMs) ? retryMs : 0,
);
await response.body?.cancel();
if (delayMs > 60_000) throw new Error("Retry deferred beyond poll budget");
await new Promise(resolve => setTimeout(resolve, delayMs));
continue;
}
if (!response.ok) {
throw new Error(`Status request ${response.status}: ${await response.text()}`);
}
const body: unknown = await response.json();
console.log({
httpStatus: response.status,
fields: body !== null && typeof body === "object" ? Object.keys(body) : [],
});
return;
}
}
inspectSmsStatus().catch(error => {
console.error(error instanceof Error ? error.message : "Status request failed");
process.exitCode = 1;
});
Keep raw error details within a restricted operator context. Don't forward them into general telemetry. These retry settings are example budgets, not measured service behavior. This probe inspects a response; the application's overall polling deadline belongs in the worker that calls it.
Now build the application evidence boundary. The next TypeScript example handles no secrets and makes no network requests. Its values are illustrative application settings, not vendor defaults or compliance requirements. The output explains the decision to request an email challenge; it leaves authentication incomplete until separate code-validation logic succeeds.
type Observation = "pending" | "delivered" | "failed";
type Evidence = {
attemptId: string;
policyVersion: string;
observations: number;
elapsedMs: number;
lastObservedStatus: Observation;
emailPreviouslyVerified: boolean;
recoveryAuthorized: boolean;
};
function decide(e: Evidence) {
const pollBudgetReached = e.observations >= 4;
const deadlineReached = e.elapsedMs >= 30_000;
const eligible =
e.emailPreviouslyVerified &&
e.recoveryAuthorized &&
(e.lastObservedStatus === "failed" ||
pollBudgetReached || deadlineReached);
return {
event: "login.recovery.decision",
attemptId: e.attemptId,
policyVersion: e.policyVersion,
observations: e.observations,
elapsedMs: e.elapsedMs,
lastObservedStatus: e.lastObservedStatus,
reason: !e.emailPreviouslyVerified
? "email_not_verified"
: !e.recoveryAuthorized
? "recovery_not_authorized"
: e.lastObservedStatus === "failed"
? "delivery_failure_observed"
: deadlineReached
? "observation_deadline_reached"
: pollBudgetReached
? "poll_budget_reached"
: "continue_sms_attempt",
nextAction: eligible ? "request_email_challenge" : "hold",
authenticated: false,
};
}
console.log(JSON.stringify(decide({
attemptId: "signup-demo-login-01",
policyVersion: "healthtech-recovery-v1",
observations: 4,
elapsedMs: 31_000,
lastObservedStatus: "pending",
emailPreviouslyVerified: true,
recoveryAuthorized: true,
})));
The example uses a deadline of 30000 ms and a budget of 4 observations to make a crucial distinction visible: an exhausted observation budget is not a delivery failure. Keep that reason in the record. The observation names above belong to the application model; map documented provider responses into them explicitly. A failed status request should produce an observation error, not a fabricated delivery outcome.
This is a decision function, not a complete authenticator. Supply recoveryAuthorized from trusted server-side policy. Before requesting a new email challenge, persist the transition atomically, retire the earlier challenge under that policy, and ensure concurrent workers cannot issue competing replacements. Record validation success separately. A late SMS delivery must never resurrect an attempt that has already completed or expired.
Keep secrets out.
For the signup link, generate an unpredictable token, store a protected verifier, enforce expiration and single use, and record redemption without retaining the raw URL in access logs. Apply the same expiration, attempt-limit, and single-use discipline to application-owned email codes. OWASP's recovery guidance is useful here. It does not certify a healthtech deployment.
The useful dashboard separates send outcomes, observation errors, recovery decisions, and completed verifications. Count fallback reasons with bounded labels such as policy version and reason; keep individual attempt IDs in restricted logs rather than metric labels. Alert on observation errors and unusual fallback volume separately, so delayed status visibility cannot masquerade as a surge in proven delivery failures. Choose thresholds from your own operating baseline. No measured latency or success rate is implied by these examples.
Limits that belong in the adoption decision
A polling-based SMS-to-email design suits basic SaaS authentication when the team accepts observation delay and owns email challenge validation. Immediate cross-channel orchestration needs a separate evaluation. Keep recovery messages immediate, and make challenge expiration authoritative instead of relying on cancellation of a scheduled email.
Scope the design to SMS and email over HTTP. Review other channel and SMTP requirements separately. Own geographic abuse controls, country-based spending cutoffs, template records, and any tag-level cost aggregation in the application. A US/EU deployment also needs documented processing locations, retention, access controls, and applicable contracts; channel availability alone supplies none of that evidence. Do not infer approval for a different jurisdiction from this comparison.
References
The sources below support the security review and the distinct product categories in the comparison. The FTC guide informs email-purpose review; it is not a substitute for health-data or regional privacy review.
Further reading
- OWASP Forgot Password Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Forgot_Password_Cheat_Sheet.html
- FTC CAN-SPAM compliance guide: https://www.ftc.gov/business-guidance/resources/can-spam-act-compliance-guide-business
- Twilio Verify documentation: https://www.twilio.com/docs/verify
- Amazon Cognito user pools: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools.html
- Auth0 multifactor authentication: https://auth0.com/docs/secure/multi-factor-authentication
- SendGrid email API: https://www.twilio.com/docs/sendgrid/api-reference/mail-send/mail-send
- Postmark email API: https://postmarkapp.com/developer/api/email-api
Top comments (0)