Using auth.api.signInEmail() doesn't return a proper Response with Two Factor plugin #243

Closed
opened 2026-03-13 07:39:26 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @FabienMotte on GitHub (Nov 18, 2024).

Describe the bug
When using auth.api.signInEmail({ body: {/* ... */, asResponse: true }) with the twoFactor plugin, only { twoFactorRedirect: true } is returned instead of a Response object (that includes headers).

29e6765759/packages/better-auth/src/plugins/two-factor/index.ts (L246-L253)

Version: 0.8.7-beta.3

Expected behavior
I would expect to get a Response object to be able to set the two factor cookie properly.

Originally created by @FabienMotte on GitHub (Nov 18, 2024). **Describe the bug** When using `auth.api.signInEmail({ body: {/* ... */, asResponse: true })` with the `twoFactor` plugin, only `{ twoFactorRedirect: true }` is returned instead of a `Response` object (that includes headers). https://github.com/better-auth/better-auth/blob/29e676575908f112f6b87dbcc93377b050b53fe5/packages/better-auth/src/plugins/two-factor/index.ts#L246-L253 Version: `0.8.7-beta.3` **Expected behavior** I would expect to get a `Response` object to be able to set the two factor cookie properly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#243