[GH-ISSUE #6264] User additional fields not returning new fields #27789

Closed
opened 2026-04-17 19:00:29 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @LickABrick on GitHub (Nov 24, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/6264

Originally assigned to: @himself65 on GitHub.

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Add additionalfield to e.g. user:

export const auth = betterAuth({
  ...
  database: drizzleAdapter(db, {
    provider: "pg",
    usePlural: true,
    schema,
  }),
  plugins: [
    organization({
      ...
    }),
  ],
  user: {
    additionalFields: {
      onboardingCompleted: {
        type: "boolean",
        required: false,
        defaultValue: false,
        input: false,
        returned: true,
      },
    },
  },
});

Generate/Migrate DB changes

(field shows correctly in DB)

Current vs. Expected behavior

When doing a signIn or signUp my additional field is not being returned.

What version of Better Auth are you using?

1.4.1

System info

{
  "system": {
    "platform": "linux",
    "arch": "x64",
    "version": "#1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025",
    "release": "6.6.87.2-microsoft-standard-WSL2",
    "cpuCount": 12,
    "cpuModel": "13th Gen Intel(R) Core(TM) i5-1335U",
    "totalMemory": "15.46 GB",
    "freeMemory": "11.14 GB"
  },
  "node": {
    "version": "v24.4.1",
    "env": "development"
  },
  "packageManager": {
    "name": "npm",
    "version": "11.4.2"
  },
  "frameworks": [
    {
      "name": "hono",
      "version": "^4.9.4"
    }
  ],
  "databases": [
    {
      "name": "pg",
      "version": "^8.16.3"
    },
    {
      "name": "drizzle",
      "version": "^0.44.5"
    }
  ],
  "betterAuth": {
    "version": "^1.4.1",
    "config": null
  }
}

Which area(s) are affected? (Select all that apply)

Backend, Types

Auth config (if applicable)

export const auth = betterAuth({
  ...
  database: drizzleAdapter(db, {
    provider: "pg",
    usePlural: true,
    schema,
  }),
  plugins: [
    organization({
      ...
    }),
  ],
  user: {
    additionalFields: {
      onboardingCompleted: {
        type: "boolean",
        required: false,
        defaultValue: false,
        input: false,
        returned: true,
      },
    },
  },
});

Additional context

Also mentioned (by me) in #3686 but unfortunately not fixed in latest release it seems.

Originally created by @LickABrick on GitHub (Nov 24, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/6264 Originally assigned to: @himself65 on GitHub. ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Add additionalfield to e.g. `user`: ``` export const auth = betterAuth({ ... database: drizzleAdapter(db, { provider: "pg", usePlural: true, schema, }), plugins: [ organization({ ... }), ], user: { additionalFields: { onboardingCompleted: { type: "boolean", required: false, defaultValue: false, input: false, returned: true, }, }, }, }); ``` Generate/Migrate DB changes _(field shows correctly in DB)_ ### Current vs. Expected behavior When doing a `signIn` or `signUp` my additional field is not being returned. ### What version of Better Auth are you using? 1.4.1 ### System info ```bash { "system": { "platform": "linux", "arch": "x64", "version": "#1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025", "release": "6.6.87.2-microsoft-standard-WSL2", "cpuCount": 12, "cpuModel": "13th Gen Intel(R) Core(TM) i5-1335U", "totalMemory": "15.46 GB", "freeMemory": "11.14 GB" }, "node": { "version": "v24.4.1", "env": "development" }, "packageManager": { "name": "npm", "version": "11.4.2" }, "frameworks": [ { "name": "hono", "version": "^4.9.4" } ], "databases": [ { "name": "pg", "version": "^8.16.3" }, { "name": "drizzle", "version": "^0.44.5" } ], "betterAuth": { "version": "^1.4.1", "config": null } } ``` ### Which area(s) are affected? (Select all that apply) Backend, Types ### Auth config (if applicable) ```typescript export const auth = betterAuth({ ... database: drizzleAdapter(db, { provider: "pg", usePlural: true, schema, }), plugins: [ organization({ ... }), ], user: { additionalFields: { onboardingCompleted: { type: "boolean", required: false, defaultValue: false, input: false, returned: true, }, }, }, }); ``` ### Additional context Also mentioned (by me) in #3686 but unfortunately not fixed in latest release it seems.
GiteaMirror added the lockedenhancement labels 2026-04-17 19:00:30 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Nov 24, 2025):

Hi there! It looks like your configuration is correct and the additional field is indeed in your database. However, we’re aware of an issue where additional fields—even when set with returned: true—aren’t being included in the signIn/signUp responses. This has been reported recently, and the team is actively investigating it. As a workaround, you might try explicitly refreshing the user session after authentication since sometimes the session endpoint does return the added fields. Please also ensure you’re using the latest patch version, as a fix might be available soon.

Could you double-check your session-handling code and let us know if manually re-fetching the session data helps? Tag @bekacru and @ping__ if the issue remains unresolved.

tag @better-auth-agent if you would like an answer from the Agent. Do you have any other questions or need more details on this workaround?

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3570778017 --> @better-auth-agent[bot] commented on GitHub (Nov 24, 2025): Hi there! It looks like your configuration is correct and the additional field is indeed in your database. However, we’re aware of an issue where additional fields—even when set with returned: true—aren’t being included in the signIn/signUp responses. This has been reported recently, and the team is actively investigating it. As a workaround, you might try explicitly refreshing the user session after authentication since sometimes the session endpoint does return the added fields. Please also ensure you’re using the latest patch version, as a fix might be available soon. Could you double-check your session-handling code and let us know if manually re-fetching the session data helps? Tag @bekacru and @ping__ if the issue remains unresolved. tag @better-auth-agent if you would like an answer from the Agent. Do you have any other questions or need more details on this workaround? <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Author
Owner

@dosubot[bot] commented on GitHub (Nov 24, 2025):

This is a known limitation in Better Auth v1.4.1: even if you set additionalFields like onboardingCompleted with returned: true and see them in your database, the signIn and signUp endpoints only return a fixed set of standard user fields (id, email, name, image, emailVerified, createdAt, updatedAt). They do not include additionalFields in the response, regardless of your config. This is a design decision to avoid exposing custom fields by default, but it’s not well documented and has caused confusion for many users (source, source).

If you want to expose additionalFields like onboardingCompleted to the client, the recommended approach is to use the customSession plugin to explicitly include those fields in the session/user object returned to the client (source). Here’s a minimal example:

import { customSession } from "better-auth/plugins";

export const auth = betterAuth({
  // ...your config
  plugins: [
    customSession({
      async session({ user, session }) {
        // Add onboardingCompleted to the returned user object
        return {
          ...session,
          user: {
            ...user,
            onboardingCompleted: user.onboardingCompleted,
          },
        };
      },
    }),
    // ...other plugins
  ],
});

Recent fixes (like PR #5735) improved how additionalFields are handled in session cookies and getSession responses, but the signIn/signUp endpoints still require explicit handling to include custom fields. Upgrading to a newer version may help with related issues, but you’ll still need to customize the session response for your use case.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

<!-- gh-comment-id:3570793518 --> @dosubot[bot] commented on GitHub (Nov 24, 2025): <!-- Answer --> This is a known limitation in Better Auth v1.4.1: even if you set additionalFields like onboardingCompleted with returned: true and see them in your database, the signIn and signUp endpoints only return a fixed set of standard user fields (id, email, name, image, emailVerified, createdAt, updatedAt). They do not include additionalFields in the response, regardless of your config. This is a design decision to avoid exposing custom fields by default, but it’s not well documented and has caused confusion for many users ([source](https://github.com/better-auth/better-auth/issues/3888), [source](https://github.com/better-auth/better-auth/blob/fc662c52dcadc9874d36bd354d53d23f8a24e098/packages/better-auth/src/api/routes/sign-up.ts#L167-L349)). If you want to expose additionalFields like onboardingCompleted to the client, the recommended approach is to use the [customSession plugin](https://www.better-auth.com/docs/concepts/session-management#customizing-session-response) to explicitly include those fields in the session/user object returned to the client ([source](https://github.com/better-auth/better-auth/issues/3888)). Here’s a minimal example: ```typescript import { customSession } from "better-auth/plugins"; export const auth = betterAuth({ // ...your config plugins: [ customSession({ async session({ user, session }) { // Add onboardingCompleted to the returned user object return { ...session, user: { ...user, onboardingCompleted: user.onboardingCompleted, }, }; }, }), // ...other plugins ], }); ``` Recent fixes (like [PR #5735](https://github.com/better-auth/better-auth/pull/5735)) improved how additionalFields are handled in session cookies and getSession responses, but the signIn/signUp endpoints still require explicit handling to include custom fields. Upgrading to a newer version may help with related issues, but you’ll still need to customize the session response for your use case. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/3fc41a44-e823-431d-a802-5db3469ccc91?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/3fc41a44-e823-431d-a802-5db3469ccc91?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/3fc41a44-e823-431d-a802-5db3469ccc91?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/3fc41a44-e823-431d-a802-5db3469ccc91?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/3fc41a44-e823-431d-a802-5db3469ccc91?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/3fc41a44-e823-431d-a802-5db3469ccc91?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/3fc41a44-e823-431d-a802-5db3469ccc91?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20known%20limitation%20in%20Better%20Auth%20v1.4.1%3A%20even%20if%20you%20set%20additionalFields%20like%20onboardingCompleted%20with%20returned%3A%20true%20and%20see%20them%20in%20your%20database%2C%20the%20signIn%20and%20signUp%20endpoints%20only%20return%20a%20fixed%20set%20of%20standard%20user%20fields%20%28id%2C%20email%2C%20name%2C%20image%2C%20emailVerified%2C%20createdAt%2C%20updatedAt%29.%20They%20do%20not%20include%20additionalFields%20in%20the%20response%2C%20regardless%20of%20your%20config.%20This%20is%20a%20design%20decision%20to%20avoid%20exposing%20custom%20fields%20by%20default%2C%20but%20it%E2%80%99s%20not%20well%20documented%20and%20has%20caused%20confusion%20for%20many%20users%20%28%5Bsource%5D%28https%3A//github.com/better-auth/better-auth/issues/3888%29%2C%20%5Bsource%5D%28https%3A//github.com/better-auth/better-auth/blob/fc662c52dcadc9874d36bd354d53d23f8a24e098/packages/better-auth/src/api/routes/sign-up.ts%23L167-L349%29%29.%0A%0AIf%20you%20want%20to%20expose%20additionalFields%20like%20onboardingCompleted%20to%20the%20client%2C%20the%20recommended%20approach%20is%20to%20use%20the%20%5BcustomSession%20plugin%5D%28https%3A//www.better-auth.com/docs/concepts/session-management%23customizing-session-response%29%20to%20explicitly%20include%20those%20fields%20in%20the%20session/user%20object%20returned%20to%20the%20client%20%28%5Bsource%5D%28https%3A//github.com/better-auth/better-auth/issues/3888%29%29.%20Here%E2%80%99s%20a%20minimal%20example%3A%0A%0A%60%60%60typescript%0Aimport%20%7B%20customSession%20%7D%20from%20%22better-auth/plugins%22%3B%0A%0Aexport%20const%20auth%20%3D%20betterAuth%28%7B%0A%20%20//%20...your%20config%0A%20%20plugins%3A%20%5B%0A%20%20%20%20customSession%28%7B%0A%20%20%20%20%20%20async%20session%28%7B%20user%2C%20session%20%7D%29%20%7B%0A%20%20%20%20%20%20%20%20//%20Add%20onboardingCompleted%20to%20the%20returned%20user%20object%0A%20%20%20%20%20%20%20%20return%20%7B%0A%20%20%20%20%20%20%20%20%20%20...session%2C%0A%20%20%20%20%20%20%20%20%20%20user%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20...user%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20onboardingCompleted%3A%20user.onboardingCompleted%2C%0A%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%7D%3B%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%7D%29%2C%0A%20%20%20%20//%20...other%20plugins%0A%20%20%5D%2C%0A%7D%29%3B%0A%60%60%60%0A%0ARecent%20fixes%20%28like%20%5BPR%20%235735%5D%28https%3A//github.com/better-auth/better-auth/pull/5735%29%29%20improved%20how%20additionalFields%20are%20handled%20in%20session%20cookies%20and%20getSession%20responses%2C%20but%20the%20signIn/signUp%20endpoints%20still%20require%20explicit%20handling%20to%20include%20custom%20fields.%20Upgrading%20to%20a%20newer%20version%20may%20help%20with%20related%20issues%2C%20but%20you%E2%80%99ll%20still%20need%20to%20customize%20the%20session%20response%20for%20your%20use%20case.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/6264)
Author
Owner

@himself65 commented on GitHub (Nov 24, 2025):

I'm fixing this

<!-- gh-comment-id:3572233675 --> @himself65 commented on GitHub (Nov 24, 2025): I'm fixing this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#27789