[GH-ISSUE #2042] Password not passed when creating user #9021

Closed
opened 2026-04-13 04:17:32 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @fusigabs on GitHub (Mar 28, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/2042

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

When using emailAndPassword, the password is not being passed to the when creating a user. I am using Prisma and an error that the "Password is required", even though it is passed through in the request.

to reproduce:

  1. Setup a BetterAuth to use emailAndPassword
const auth = betterAuth({
  emailAndPassword: {
    enabled: true,
    requireEmailVerification: false,
  },
  user: {
    additionalFields: {
      username: {
        type: "string",
        required: true,
        fieldName: "username",
        input: true,
      }
    },
  },
  database: prismaAdapter(prisma, {
    provider: "mysql",
  }),
});

  1. Try to send a request to register a user
await signUp.email({
    email: "john@email.com",
    name: "John Doe",
    password: "password123",
    username: "jdoe"
  });
  1. In [...all].ts I have
import { auth } from "~~/server/lib/auth";

export default defineEventHandler(async (event) => {
  return auth.handler(toWebRequest(event));
});

this throws an error that 'password is required'.

Current vs. Expected behavior

The user should be created given that all the required data is passed in.

What version of Better Auth are you using?

1.2.5

Provide environment information

- MacOS
- MySQL Database
- Prisma adapter
- Running in Nuxt.js v4

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

Backend

Auth config (if applicable)

import { betterAuth } from "better-auth"
const auth = betterAuth({
  emailAndPassword: {
    enabled: true,
    requireEmailVerification: false,
  },
  user: {
    additionalFields: {
      username: {
        type: "string",
        required: true,
        fieldName: "username",
        input: true,
      }
    },
  },
  database: prismaAdapter(prisma, {
    provider: "mysql",
  }),
});

Additional context

No response

Originally created by @fusigabs on GitHub (Mar 28, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/2042 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce When using emailAndPassword, the password is not being passed to the when creating a user. I am using Prisma and an error that the "Password is required", even though it is passed through in the request. to reproduce: 1. Setup a BetterAuth to use `emailAndPassword` ```js const auth = betterAuth({ emailAndPassword: { enabled: true, requireEmailVerification: false, }, user: { additionalFields: { username: { type: "string", required: true, fieldName: "username", input: true, } }, }, database: prismaAdapter(prisma, { provider: "mysql", }), }); ``` 2. Try to send a request to register a user ```js await signUp.email({ email: "john@email.com", name: "John Doe", password: "password123", username: "jdoe" }); ``` 3. In `[...all].ts` I have ``` import { auth } from "~~/server/lib/auth"; export default defineEventHandler(async (event) => { return auth.handler(toWebRequest(event)); }); ``` this throws an error that 'password is required'. ### Current vs. Expected behavior The user should be created given that all the required data is passed in. ### What version of Better Auth are you using? 1.2.5 ### Provide environment information ```bash - MacOS - MySQL Database - Prisma adapter - Running in Nuxt.js v4 ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" const auth = betterAuth({ emailAndPassword: { enabled: true, requireEmailVerification: false, }, user: { additionalFields: { username: { type: "string", required: true, fieldName: "username", input: true, } }, }, database: prismaAdapter(prisma, { provider: "mysql", }), }); ``` ### Additional context _No response_
GiteaMirror added the lockedbug labels 2026-04-13 04:17:32 -05:00
Author
Owner

@fusigabs commented on GitHub (Mar 28, 2025):

Ok it was my error. I had accidentally added password as additional data as well.

<!-- gh-comment-id:2762403972 --> @fusigabs commented on GitHub (Mar 28, 2025): Ok it was my error. I had accidentally added password as additional data as well.
Author
Owner

@alexewsv commented on GitHub (Nov 27, 2025):

hello @fusigabs how do you solve it?

<!-- gh-comment-id:3584835066 --> @alexewsv commented on GitHub (Nov 27, 2025): hello @fusigabs how do you solve it?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9021