[PR #1445] [MERGED] Activate OTP Verification without Insecure skipVerificationOnEnable Option #3810

Closed
opened 2026-03-13 11:14:25 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/1445
Author: @GregorWedlich
Created: 2/14/2025
Status: Merged
Merged: 2/20/2025
Merged by: @Bekacru

Base: mainHead: refise-otp-verify-check


📝 Commits (10+)

📊 Changes

1 file changed (+24 additions, -6 deletions)

View changed files

📝 packages/better-auth/src/plugins/two-factor/otp/index.ts (+24 -6)

📄 Description

This PR updates the OTP verification flow so that OTP-based two-factor authentication works similarly to TOTP verification. Previously, the OTP endpoint checked whether twoFactorEnabled was already active. Since OTP is used for activation, that check could not succeed unless the insecure option skipVerificationOnEnable: true was used, which bypasses the verification process and lowers the overall security level.

With these changes, upon correct OTP submission, the user’s twoFactorEnabled status is updated to true, and the session is refreshed accordingly.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/1445 **Author:** [@GregorWedlich](https://github.com/GregorWedlich) **Created:** 2/14/2025 **Status:** ✅ Merged **Merged:** 2/20/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `refise-otp-verify-check` --- ### 📝 Commits (10+) - [`e38fe9e`](https://github.com/better-auth/better-auth/commit/e38fe9ed803a97020679e787be10dbf5e7fb13cc) Revise Email and Password integration docs: improved clarity and added new examples - [`c28fcc9`](https://github.com/better-auth/better-auth/commit/c28fcc9ebdb1ea0c89e7e4e0fc6f5a028ca1d319) Merge branch 'main' of https://github.com/GregorWedlich/better-auth - [`c1ee4a4`](https://github.com/better-auth/better-auth/commit/c1ee4a4997a4531e0d835f261a6396e9d653fb03) Merge branch 'main' of https://github.com/GregorWedlich/better-auth - [`75d73c4`](https://github.com/better-auth/better-auth/commit/75d73c4dbeba7d84e548e56779818d01cb528736) Merge branch 'main' of https://github.com/GregorWedlich/better-auth - [`86b576b`](https://github.com/better-auth/better-auth/commit/86b576bfd3648e9e7f98ffd692a7b0d489a83a2b) Merge branch 'main' of https://github.com/GregorWedlich/better-auth - [`103a5e4`](https://github.com/better-auth/better-auth/commit/103a5e45e14e2ecdcaad35e8d40e573f9b3e9986) Merge branch 'main' of https://github.com/GregorWedlich/better-auth - [`c4d70cd`](https://github.com/better-auth/better-auth/commit/c4d70cd1cd238a091a9c398aac3ad2ee0fd23880) Merge branch 'main' of https://github.com/GregorWedlich/better-auth - [`4a0fefe`](https://github.com/better-auth/better-auth/commit/4a0fefe6a8321c09ee164046682cc518624bdbbf) Merge branch 'main' of https://github.com/GregorWedlich/better-auth - [`c46fb8d`](https://github.com/better-auth/better-auth/commit/c46fb8db8250d305b9a80fa5ba00ff0b1eca7653) Merge branch 'main' of https://github.com/GregorWedlich/better-auth - [`9384ff8`](https://github.com/better-auth/better-auth/commit/9384ff81c8b89ce9137a3675a0cad8a63c823796) Merge branch 'main' of https://github.com/GregorWedlich/better-auth ### 📊 Changes **1 file changed** (+24 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/two-factor/otp/index.ts` (+24 -6) </details> ### 📄 Description This PR updates the OTP verification flow so that OTP-based two-factor authentication works similarly to TOTP verification. Previously, the OTP endpoint checked whether twoFactorEnabled was already active. Since OTP is used for activation, that check could not succeed unless the insecure option skipVerificationOnEnable: true was used, which bypasses the verification process and lowers the overall security level. With these changes, upon correct OTP submission, the user’s twoFactorEnabled status is updated to true, and the session is refreshed accordingly. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 11:14:25 -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#3810