fix(mfa): wire real WebOTP auto-fill into AuthorizerVerifyOtp#67
Merged
Conversation
autoComplete="one-time-code" was a declarative hint with nothing behind it - no call site anywhere called navigator.credentials.get(), so platforms that need the explicit WebOTP call (e.g. Android Chrome) got no auto-fill benefit at all. Add a feature-detected (window.OTPCredential) navigator.credentials.get() call, scoped to an actual SMS-OTP factor (not TOTP/email-OTP, which never arrive by SMS) via a new hasSmsOtp prop threaded from every caller that knows which factor is pending. Aborted via AbortController on unmount, on manual submit, and whenever the screen switches away from the code form, so a late resolution can never clobber a value the user already submitted. Closes #66
size-limit report 📦
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hasSmsOtpprop toAuthorizerVerifyOtp, threaded from every caller (AuthorizerRoot,AuthorizerPasskeyLogin,AuthorizerBasicAuthLogin,AuthorizerSignup,AuthorizerMFASetup) from the real signal each already has (mfaMethods.includes('sms_otp'),mfaStep.mobile,step.mobile,otpMethodPending === 'sms_otp') - not aphone_number-truthiness guessnavigator.credentials.get({ otp: { transport: ['sms'] }, signal }), feature-detected viawindow.OTPCredential- the explicit call the existingautoComplete="one-time-code"hint always implied but nothing backedAbortControlleron unmount, on manual submit, and whenever the screen switches away from the code form (TOTP recovery scanner, passkey lockout) - a late resolution can never clobber a value already submittedAlso checked
authorizer-js#50(pending breaking change to.webhooks()/.emailTemplates()/.verificationRequests()pagination shape) - confirmed via a repo-wide search that this package never importsAuthorizerAdminor calls any of the three affected methods. No adjustment needed here regardless of when that PR merges/releases.Test plan
tsc --noEmitpassesnpm run buildpassesCloses #66