[PR #5739] Added Two-Factor option to skip TOTP code creation #14437

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

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

State: open
Merged: No


I added an option to the API to skip TOTP creation so that you can enable two factor auth for the OTP method.


Summary by cubic

Add a new twoFactorMethod option to enable 2FA using OTP without generating TOTP codes or QR data. Default remains TOTP, so existing integrations keep working.

  • New Features
    • API: twoFactor.enable accepts twoFactorMethod: "otp" | "totp" (default "totp").
    • "otp" skips TOTP setup and verification-on-enable, marks the user 2FA-enabled, and returns { twoFactor: true }.
    • "totp" continues to return totpURI and backupCodes as before.
    • Docs updated to show the new parameter.
    • Test added for the OTP path to ensure no TOTP artifacts are created.

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

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5739 **State:** open **Merged:** No --- I added an option to the API to skip TOTP creation so that you can enable two factor auth for the OTP method. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Add a new twoFactorMethod option to enable 2FA using OTP without generating TOTP codes or QR data. Default remains TOTP, so existing integrations keep working. - **New Features** - API: twoFactor.enable accepts twoFactorMethod: "otp" | "totp" (default "totp"). - "otp" skips TOTP setup and verification-on-enable, marks the user 2FA-enabled, and returns { twoFactor: true }. - "totp" continues to return totpURI and backupCodes as before. - Docs updated to show the new parameter. - Test added for the OTP path to ensure no TOTP artifacts are created. <sup>Written for commit a5601c39d583b366bc3cd90cd1e64c995fc2d160. 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:28:30 -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#14437