[PR #3368] [CLOSED] feat: use parseUserOutput on user data returned by sign-in and sign-up routes #30389

Closed
opened 2026-04-17 21:30:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3368
Author: @aleclarson
Created: 7/14/2025
Status: Closed

Base: mainHead: feat/parseUserOutput-sign-in-and-up


📝 Commits (4)

  • 1c7ea1b feat: use parseUserOutput on user data returned by sign-in and sign-up routes
  • d098275 chore: use more exact import specifier
  • 431e6c3 fix: use reference to User schema in OpenAPI response metadata
  • a2b3f09 fix: update the signInSocial endpoint as well

📊 Changes

3 files changed (+11 additions, -154 deletions)

View changed files

📝 packages/better-auth/src/api/routes/sign-in.ts (+5 -80)
📝 packages/better-auth/src/api/routes/sign-up.ts (+4 -63)
📝 packages/better-auth/src/plugins/username/index.ts (+2 -11)

📄 Description

I'm using the Username plugin and I need the displayUsername returned from the sign-in and sign-up routes. It appears that, currently, only a pre-defined set of user properties are returned by these routes, which is not ideal.

While perusing the codebase, I found parseUserOutput, which should allow plugin-defined user properties to be returned, as long as they don't have returned: false set on their schema definition. That last part means that parseUserOutput is an ideal solution, since it will guard against exposing sensitive user data to the client unintentionally.


Summary by cubic

Updated the sign-in and sign-up routes to use parseUserOutput when returning user data, so plugin-defined user fields like displayUsername are included if allowed by their schema.

  • Refactors
    • Replaced hardcoded user property lists with parseUserOutput in sign-in, sign-up, and username plugin routes.

🔄 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/3368 **Author:** [@aleclarson](https://github.com/aleclarson) **Created:** 7/14/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/parseUserOutput-sign-in-and-up` --- ### 📝 Commits (4) - [`1c7ea1b`](https://github.com/better-auth/better-auth/commit/1c7ea1bdcb9371d120e2d647e7e0c9821c78d5aa) feat: use `parseUserOutput` on user data returned by sign-in and sign-up routes - [`d098275`](https://github.com/better-auth/better-auth/commit/d098275118b9dd0cd8183fa43445a8db83c99235) chore: use more exact import specifier - [`431e6c3`](https://github.com/better-auth/better-auth/commit/431e6c3dbb560a53a9de3467e4a27659d3980cb1) fix: use reference to User schema in OpenAPI response metadata - [`a2b3f09`](https://github.com/better-auth/better-auth/commit/a2b3f09904b78954c024f1d33d0261ec69bd636b) fix: update the signInSocial endpoint as well ### 📊 Changes **3 files changed** (+11 additions, -154 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/sign-in.ts` (+5 -80) 📝 `packages/better-auth/src/api/routes/sign-up.ts` (+4 -63) 📝 `packages/better-auth/src/plugins/username/index.ts` (+2 -11) </details> ### 📄 Description I'm using the Username plugin and I need the `displayUsername` returned from the sign-in and sign-up routes. It appears that, currently, only a pre-defined set of user properties are returned by these routes, which is not ideal. While perusing the codebase, I found `parseUserOutput`, which should allow plugin-defined user properties to be returned, as long as they don't have `returned: false` set on their schema definition. That last part means that `parseUserOutput` is an ideal solution, since it will guard against exposing sensitive user data to the client unintentionally. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Updated the sign-in and sign-up routes to use `parseUserOutput` when returning user data, so plugin-defined user fields like `displayUsername` are included if allowed by their schema. - **Refactors** - Replaced hardcoded user property lists with `parseUserOutput` in sign-in, sign-up, and username plugin routes. <!-- 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 21:30: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#30389