[PR #4876] [CLOSED] fix(two-factor): forward invalid errorKey when verifying existing session #31232

Closed
opened 2026-04-17 22:08:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4876
Author: @hartbit
Created: 9/24/2025
Status: Closed

Base: canaryHead: patch-2


📝 Commits (1)

  • 1afa79a [two-factor] fix: forward invalid errorKey when verifying existing session

📊 Changes

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

View changed files

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

📄 Description

I noticed, while debugging two-factor integration inside my app, that when verifyTwoFactor is called with an existing session (to confirm enabling two factor), that error messages are not propagated correctly.


Summary by cubic

Forward the specific invalid errorKey in two-factor verification for existing sessions so clients get accurate error messages. Previously, all failures were returned as INVALID_TWO_FACTOR_COOKIE.


🔄 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/4876 **Author:** [@hartbit](https://github.com/hartbit) **Created:** 9/24/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `patch-2` --- ### 📝 Commits (1) - [`1afa79a`](https://github.com/better-auth/better-auth/commit/1afa79ac59d0fc91ecae8f1a568f5742f0be693d) [two-factor] fix: forward invalid errorKey when verifying existing session ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/two-factor/verify-two-factor.ts` (+2 -2) </details> ### 📄 Description I noticed, while debugging two-factor integration inside my app, that when `verifyTwoFactor` is called with an existing session (to confirm enabling two factor), that error messages are not propagated correctly. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Forward the specific invalid errorKey in two-factor verification for existing sessions so clients get accurate error messages. Previously, all failures were returned as INVALID_TWO_FACTOR_COOKIE. <!-- 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-04-17 22:08:04 -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#31232