[PR #6287] [MERGED] fix: signIn/signUp API returns user additional field #23471

Closed
opened 2026-04-15 21:44:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6287
Author: @himself65
Created: 11/25/2025
Status: Merged
Merged: 11/25/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/11/24/res-type


📝 Commits (2)

  • 0cb662e feat: api returns user additional field
  • c59b628 Update test/unit/types/index.test.ts

📊 Changes

6 files changed (+569 additions, -480 deletions)

View changed files

📝 packages/better-auth/src/api/index.ts (+2 -2)
📝 packages/better-auth/src/api/routes/sign-in.ts (+474 -447)
📝 packages/better-auth/src/api/routes/sign-up.ts (+14 -19)
📝 packages/better-auth/src/db/field.ts (+14 -8)
📝 packages/better-auth/src/types/models.ts (+4 -4)
test/unit/types/index.test.ts (+61 -0)

📄 Description

Fixes: https://github.com/better-auth/better-auth/issues/6264


Summary by cubic

Returns user.additionalFields in sign-in and sign-up responses, filtered by the returned flag, and updates types so non-returned fields are excluded. Fixes better-auth/better-auth#6264.

  • New Features

    • Include additional user fields with returned: true in sign-in (email/social) and sign-up responses.
    • Exclude fields with returned: false from responses and from InferUser types.
    • When returned is not set, include the field by default.
    • Consistent filtering via parseUserOutput.
  • Refactors

    • signInEmail/signInSocial endpoints now option-aware () and wired in getEndpoints.
    • Type system updates: field inference now respects "output" vs "input" and the returned flag; added type tests for InferUser.

Written for commit c59b6280e7. Summary will update automatically 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/6287 **Author:** [@himself65](https://github.com/himself65) **Created:** 11/25/2025 **Status:** ✅ Merged **Merged:** 11/25/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/11/24/res-type` --- ### 📝 Commits (2) - [`0cb662e`](https://github.com/better-auth/better-auth/commit/0cb662e435cb2355f04442724ab0986b7a94fa7f) feat: api returns user additional field - [`c59b628`](https://github.com/better-auth/better-auth/commit/c59b6280e74c8b5c53bd8f882d0883895373f837) Update test/unit/types/index.test.ts ### 📊 Changes **6 files changed** (+569 additions, -480 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/index.ts` (+2 -2) 📝 `packages/better-auth/src/api/routes/sign-in.ts` (+474 -447) 📝 `packages/better-auth/src/api/routes/sign-up.ts` (+14 -19) 📝 `packages/better-auth/src/db/field.ts` (+14 -8) 📝 `packages/better-auth/src/types/models.ts` (+4 -4) ➕ `test/unit/types/index.test.ts` (+61 -0) </details> ### 📄 Description Fixes: https://github.com/better-auth/better-auth/issues/6264 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Returns user.additionalFields in sign-in and sign-up responses, filtered by the returned flag, and updates types so non-returned fields are excluded. Fixes better-auth/better-auth#6264. - **New Features** - Include additional user fields with returned: true in sign-in (email/social) and sign-up responses. - Exclude fields with returned: false from responses and from InferUser types. - When returned is not set, include the field by default. - Consistent filtering via parseUserOutput. - **Refactors** - signInEmail/signInSocial endpoints now option-aware (<O extends BetterAuthOptions>) and wired in getEndpoints. - Type system updates: field inference now respects "output" vs "input" and the returned flag; added type tests for InferUser. <sup>Written for commit c59b6280e74c8b5c53bd8f882d0883895373f837. Summary will update automatically 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-04-15 21:44:39 -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#23471