Skip to content

fix: honor SMS hook and test OTPs with Twilio Verify in reauth and MFA - #2941

Open
rgallegocode wants to merge 1 commit into
supabase:masterfrom
rgallegocode:fix/twilio-verify-locally-sent-otp
Open

rgallegocode wants to merge 1 commit into
supabase:masterfrom
rgallegocode:fix/twilio-verify-locally-sent-otp

Conversation

@rgallegocode

Copy link
Copy Markdown

What kind of change does this PR introduce?

Bug fix, fixes #2940

What is the current behavior?

With twilio_verify as the SMS provider, reauthentication and phone MFA verification always ask Twilio Verify to check the code, even when it was sent through the Send SMS hook or is a test OTP. In both cases the code is only stored locally, so verification fails with 403 otp_expired.

What is the new behavior?

Same checks /verify already does: skip Twilio Verify when the Send SMS hook is enabled, and in reauthentication also for test OTP numbers. The code is then compared against the stored hash.

Test OTPs for phone MFA are left out since that's #2761.

Additional context

New tests TestUserUpdatePasswordReauthenticationPhoneTwilioVerify and TestMFAVerifyPhoneFactorSendSMSHookTwilioVerify mock the Twilio Verify API and fail without the fix. go test ./... -p 1 -race passes.

#2685 touches the same lines in reauthenticate.go and mfa.go (rename only), so whichever lands second needs a small rebase.

@rgallegocode
rgallegocode requested a review from a team as a code owner November 18, 2026 18:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reauthentication and phone MFA always fail with Twilio Verify when the Send SMS hook or test OTPs are used

1 participant