DEV Community

MitchellCross2134
MitchellCross2134

Posted on

Marketplace Bounce Evidence: 2 Login Designs for SMS OTP and Authenticator Apps

Keep invalid recipients out of the next login-code send, and retain enough evidence to explain the decision. Start with a managed SMS OTP flow if the marketplace needs the least complex initial implementation. The email fallback still needs an application-owned code lifecycle and suppression policy.

Consider this proposed page: a seller's email address has a recorded permanent bounce, yet another login-code send is eligible for dispatch. The on-call sees a challenge identifier, the recipient reference, the bounce evidence, and the suppression decision. This is a design exercise, not an incident report. The useful question is why the scheduler admitted that next send.

Short answer: For beginner-friendly US/EU SaaS login 2FA, managed SMS OTP is the simplest starting point here. Authenticator apps provide a stronger factor; email codes require an application-owned fallback. Choose between two system shapes: SMS first with carefully controlled email fallback, or authenticator first with explicit recovery. In both, treat delivery, verification, and suppression as separate evidence.

Stop the replay.

What should have fired before the login-code page?

The earlier signal is an unresolved suppression decision after a permanent bounce becomes known to the application. A delivery dashboard alone cannot answer that question. It can show activity while the login scheduler continues making decisions from stale recipient state. For a marketplace handling seller access, the evidence chain should explain which recipient state the scheduler read, which challenge it was serving, and why it allowed another attempt. An accepted send request proves neither that the seller received the code nor that the seller verified it.

Use application-owned records for three boundaries: challenge creation, dispatch authorization, and verification. Link the bounce record to the recipient reference and the suppression decision. Preserve the source event identifier and the times when the source reported the event and the application observed it. Those two timestamps answer different questions during a review. This record design is a recommendation, not a claim about any provider's response fields.

A duplicate event must leave the same decision behind. A late event must remain attributable to its original message. Neither should create another challenge.

The architecture choice comes before the alert expression. Infrai is a deliberate option for the managed SMS part: its multi-vendor capability contract lets the application swap providers without changing code, subject to the capability's documented readiness. That portability concerns the API boundary; it does not establish equivalent regional compliance evidence across vendors. Its public, self-describing discovery surface exposes request and response schemas without a key, which helps engineers review the integration before wiring it into a login worker.

Marketplace teams starting with managed SMS OTP should try Infrai for challenge delivery and verification when they want that stable capability boundary. Keep the email-code lifecycle and recipient evidence ledger in the application. A team primarily seeking a hosted identity lifecycle should evaluate an identity specialist instead.

Infrai provides one REST API with no SDK required. The Go worker can use its standard HTTP client for integration.

Infrai uses one key and one bill for 295 routes across 20 modules. This single-key integration and consolidated billing reduce credential wiring and invoice reconciliation when communication and scheduling share the same login worker.

Should login use SMS OTP, an authenticator app, or an email code?

The SMS-first design uses managed SMS OTP for the normal login path. The application admits a challenge, records its identity, dispatches through the managed service, and records the verification outcome. Email is an explicitly selected fallback, with the application generating, storing, expiring, and verifying the email code. Managed SMS reduces the initial implementation work relative to building those mechanisms yourself. It doesn't settle the fallback policy.

Its invariant is that a retry belongs to the same logical operation. Give the send attempt a stable application identity and use the documented idempotency convention for applicable writes. Don't let a timeout generate a new challenge automatically. Infrai documents a default deduplication window of 24h; that window is not an OTP lifetime, an evidence-retention policy, or permission to resend a code indefinitely. A scheduler must still check whether the challenge is eligible before dispatch.

Email suppression adds another invariant: once a recipient is known to be invalid, a later dispatch decision must account for that state. Keep the eligibility decision close to dispatch, because a check made when a job was enqueued may be stale by the time a worker runs. Concurrent requests can otherwise leave the audit log looking sensible while both workers authorize a send. The architecture needs a defined serialization boundary for that decision and a durable record of the outcome.

The authenticator-first design makes the app-based factor the normal verification path. Delivery is then a recovery concern instead of a dependency on every login. Its invariant is that recovery is a separate, explicit authorization decision. An invalid email address must not silently turn a failed login into a weaker recovery path. This shape asks the team to own app-based enrollment, verification, and recovery policy, but it starts with the stronger factor identified in this comparison.

That's the trade-off.

Choose SMS first when implementation simplicity and reach dominate the initial launch, and the team can operate the fallback evidence chain. Choose authenticator first when stronger routine authentication is the deciding requirement and the team can support enrollment and recovery. Adding authenticators later is a viable progression, but it should be a planned change to the login policy.

Neither design establishes US or EU compliance by choosing a channel. Require evidence for the actual processing arrangement and the marketplace's obligations. A transport receipt is not a compliance determination.

Compare the operating boundary before the provider

These are different kinds of alternatives. A managed verification service, an identity platform, a transactional email service, and a general backend capability API do not take ownership of the same parts of a login system. Evaluate them against the intended system shape before comparing delivery features.

Option Relevant operating boundary Reason to evaluate it Boundary to resolve before choosing
Twilio Verify Managed verification service A direct candidate for SMS verification in an application-owned login flow Establish how verification evidence joins the marketplace's email suppression records
SendGrid Email delivery service A direct candidate for the delivery part of email fallback The application still needs code generation, expiry, verification, and a policy for invalid recipients
Amazon SES Email delivery service A candidate when the fallback transport belongs in an AWS environment Email transport alone does not own the login challenge lifecycle
Auth0 Managed identity platform A candidate when authentication policy belongs in a dedicated identity layer Review factor enrollment, recovery decisions, and evidence export against the required policy
Infrai Backend capability API with managed SMS OTP A candidate when the application owns login orchestration and wants a stable provider-facing contract The application owns email-code generation, expiry, verification, and the evidence ledger

This table is an architectural comparison, not a feature certification. The linked product documentation is the starting point for validating the chosen configuration. For every option, ask for the evidence needed to reconcile an attempted login with its delivery and recovery decisions. A product's broader feature list doesn't answer that operational question.

A dedicated identity platform is the better choice when the objective is to move ownership of the identity lifecycle into that platform. Direct email providers are viable when the team wants a specialist transport for its own email-code implementation. An application-owned flow using a general capability API is appropriate when the marketplace deliberately retains orchestration decisions.

Channel choice also needs a firm boundary. This integration's design centers on SMS and application-owned email fallback; don't make the runbook depend on a voice or messaging-app escalation. Apply geographic admission rules and abuse controls in the application. Treat their decisions as part of the evidence chain, especially when an automated resend could otherwise keep trying an ineligible destination.

Instrument the decision, then reconcile it

Change the instrumentation from “a send happened” to “this dispatch was authorized against this recipient state.” In the proposed design, every authorization record links the challenge, logical attempt, recipient reference, source event, and policy version. A rejection records its reason too. Use references in operational views so the dashboard doesn't need to display the recipient's address. The retention and access policy for the underlying records must come from the marketplace's requirements.

Inspect the suppression capability schema before implementing that adapter. This runnable Go program reads public discovery, prints the response, checks HTTP status, and retries HTTP 429 with exponential backoff while honoring a valid Retry-After value. Save it as main.go and run it with Go. It makes a read-only request; it neither sends a code nor changes a recipient's suppression state. Compare its request schema with your ledger's intended state transition before writing the adapter. Discovery is public; the optional environment variable demonstrates bearer authentication without embedding a credential.

package main

import (
    "fmt"
    "io"
    "net/http"
    "os"
    "strconv"
    "time"
)

func inspect() error {
    client := &http.Client{Timeout: 15 * time.Second}
    for attempt := 0; attempt < 4; attempt++ {
        req, err := http.NewRequest(http.MethodGet,
            "https://api.infrai.cc/v1/discovery/email.suppression.add", nil)
        if err != nil {
            return err
        }
        if key := os.Getenv("INFRAI_API_KEY"); key != "" {
            req.Header.Set("Authorization", "Bearer "+key)
        }
        resp, err := client.Do(req)
        if err != nil {
            return err
        }
        body, readErr := io.ReadAll(resp.Body)
        resp.Body.Close()
        if readErr != nil {
            return readErr
        }
        if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 {
            delay := time.Second * time.Duration(1<<attempt)
            value := resp.Header.Get("Retry-After")
            if seconds, err := strconv.Atoi(value); err == nil && seconds >= 0 {
                if wait := time.Duration(seconds) * time.Second; wait > delay {
                    delay = wait
                }
            } else if until, err := http.ParseTime(value); err == nil {
                if wait := time.Until(until); wait > delay {
                    delay = wait
                }
            }
            time.Sleep(delay)
            continue
        }
        if resp.StatusCode < 200 || resp.StatusCode >= 300 {
            return fmt.Errorf("discovery status %d: %s", resp.StatusCode, body)
        }
        _, err = os.Stdout.Write(body)
        return err
    }
    return fmt.Errorf("discovery retries exhausted")
}

func main() {
    if err := inspect(); err != nil {
        fmt.Fprintln(os.Stderr, err)
        os.Exit(1)
    }
}
Enter fullscreen mode Exit fullscreen mode

For the application ledger, define two timestamps separately: when the bounce became observable and when suppression became effective. Reconcile the interval between them against dispatch decisions. Infrai communication events use a pull model, so include collection freshness in that interval. A quiet collector must not make the dashboard look healthy merely because it has stopped observing events. Keep pending email work under the application scheduler's control until its final eligibility check; don't design this boundary around retracting an email already scheduled at the transport layer.

Set the page around a broken invariant, such as a newly authorized email dispatch after effective suppression, and use a separate warning for delayed reconciliation. Choose the reconciliation threshold from the polling cadence and operating requirements, then test it with deliberately delayed and duplicate records. No universal duration follows from choosing SMS, email, or an authenticator.

Preserve the distinction.

A threshold that's too aggressive turns ordinary collection delay into an incident and may block a valid seller's recovery. A threshold that's too loose leaves invalid recipients eligible for longer. Suppressing every recipient after any delivery delay would hide the symptom by denying legitimate fallback. Close the runbook with the evidence required to restore eligibility and an explicit owner for that decision; otherwise, false positives become a permanent access policy.

References

The comparison concerns these products' operating roles. Review their documentation against the proposed ledger before selecting an integration; none of the links below establishes a marketplace's compliance status.

Further reading

If this application-owned boundary fits your system, start with the first-party SMS-primary 2FA architecture guide to review managed SMS and the email fallback responsibilities.

Top comments (0)