[PR #8162] [MERGED] fix(two-factor): handle undefined options verifyTwoFactor #7789

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8162
Author: @okisdev
Created: 2/26/2026
Status: Merged
Merged: 2/27/2026
Merged by: @himself65

Base: canaryHead: fix(two-factor)/handle-undefined-options-verifyTwoFactor


📝 Commits (1)

  • da361e8 fix(two-factor): handle undefined options verifyTwoFactor

📊 Changes

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

View changed files

📝 packages/better-auth/src/plugins/two-factor/verify-two-factor.ts (+1 -1)

📄 Description

This PR fixes when twoFactor() is called without arguments, plugin.options is undefined.

Before:

plugins: [
    twoFactor({}),
],

After:

plugins: [
    twoFactor(),
],

Summary by cubic

Fixes a runtime error in two-factor verification when the plugin is used without options. We now read plugin.options?.trustDeviceMaxAge and fall back to the default cookie max age, so twoFactor() works without arguments.

Written for commit da361e8efc. Summary will update on new commits.


🔄 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/8162 **Author:** [@okisdev](https://github.com/okisdev) **Created:** 2/26/2026 **Status:** ✅ Merged **Merged:** 2/27/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix(two-factor)/handle-undefined-options-verifyTwoFactor` --- ### 📝 Commits (1) - [`da361e8`](https://github.com/better-auth/better-auth/commit/da361e8efc95d156f5b5e65571728d9d9e4760a2) fix(two-factor): handle undefined options verifyTwoFactor ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/two-factor/verify-two-factor.ts` (+1 -1) </details> ### 📄 Description This PR fixes when `twoFactor()` is called without arguments, `plugin.options` is undefined. Before: ```ts plugins: [ twoFactor({}), ], ``` After: ```ts plugins: [ twoFactor(), ], ``` <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes a runtime error in two-factor verification when the plugin is used without options. We now read plugin.options?.trustDeviceMaxAge and fall back to the default cookie max age, so twoFactor() works without arguments. <sup>Written for commit da361e8efc95d156f5b5e65571728d9d9e4760a2. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <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 13:49:14 -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#7789