Skip to content

feat(otp): handle test OTPs and Twilio Verify on the one_time_tokens path - #2798

Open
annabkr wants to merge 2 commits into
annabaker/auth-1553-switch-one_time_tokens-table-to-source-of-truthfrom
annabaker/auth-1553-ott-phone-providers
Open

feat(otp): handle test OTPs and Twilio Verify on the one_time_tokens path#2798
annabkr wants to merge 2 commits into
annabaker/auth-1553-switch-one_time_tokens-table-to-source-of-truthfrom
annabaker/auth-1553-ott-phone-providers

Conversation

@annabkr

@annabkr annabkr commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Implementing the TestOTP + Twilio Verify logic that were intentionally deferred in #2788.

What kind of change does this PR introduce?

Feat

What is the current behavior?

The config.Experimental.EnableOTTAsSourceOfTruth code path does not support Test OTPs or Twilio Verify.

What is the new behavior?

It does 🥳

Additional context

Closes AUTH-1553

@annabkr
annabkr force-pushed the annabaker/auth-1553-switch-one_time_tokens-table-to-source-of-truth branch from 31b4e74 to 6d15a97 Compare September 10, 2026 14:50
@annabkr
annabkr force-pushed the annabaker/auth-1553-ott-phone-providers branch from 00c7dc6 to f6300e4 Compare September 10, 2026 14:50
…path

Restore the phone-provider branches removed from the parent PR. Test OTPs
keep the identifier lookup because they have no stored challenge. Twilio
Verify finds the challenge row by relates_to and asks Twilio to check the
code.
@annabkr
annabkr force-pushed the annabaker/auth-1553-ott-phone-providers branch from f6300e4 to 45310c3 Compare September 10, 2026 20:57
// verifyTypeToTokenType maps a verification type that has exactly one token
// type. ok is false for an unknown type. ConfirmationToken is the zero value of
// OneTimeTokenType, so callers must check ok instead of the returned type.
func verifyTypeToTokenType(verifyType string) (models.OneTimeTokenType, bool) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked this better, and the _, ok syntax is more idiomatic.

Comment on lines +547 to +551
func (ts *VerifyTestSuite) configureTestOTP(phone, otp string) func() {
previous := ts.Config.Sms.TestOTP
ts.Config.Sms.TestOTP = map[string]string{phone: otp}
return func() { ts.Config.Sms.TestOTP = previous }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern just lets us set + unset a config value.

@annabkr
annabkr marked this pull request as ready for review September 11, 2026 20:31
@annabkr
annabkr requested a review from a team as a code owner September 11, 2026 20:31
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.

1 participant