[PR #5961] feat(phone-number): support custom otp genration #14595

Open
opened 2026-04-13 09:32:18 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5961

State: open
Merged: No


closes #4702

based on #1159


Summary by cubic

Adds support for custom OTP generation in the phoneNumber plugin so apps can control OTP format. Falls back to the default generator when not provided.

  • New Features
    • Added generateOTP option (sync/async) to PhoneNumberOptions for custom code generation; accepts otpLength and returns a string.
    • Applied in verification during sign-in, sendOtp, and password reset flows.
    • Updated docs with usage example and added tests to verify custom generator behavior.

Written for commit aefc4820cd. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5961 **State:** open **Merged:** No --- closes #4702 based on #1159 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds support for custom OTP generation in the phoneNumber plugin so apps can control OTP format. Falls back to the default generator when not provided. - **New Features** - Added generateOTP option (sync/async) to PhoneNumberOptions for custom code generation; accepts otpLength and returns a string. - Applied in verification during sign-in, sendOtp, and password reset flows. - Updated docs with usage example and added tests to verify custom generator behavior. <sup>Written for commit aefc4820cd39f424b8e0b0f693e789676ebb65ce. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:32:18 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#14595