additionalFields not returned in signIn
Hello, the issue is the additionnalField of user is not return in signIn with email
return of signIn with email :
wanted return :
it's worked on get session :
export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema: authSchema
}),
basePath: "/auth",
trustedOrigins: ['*'],
emailAndPassword: {
enabled: true,
},
user: {
additionalFields: {
userType: {
type: "string",
required: false,
returned: true,
defaultValue: UserType.CUSTOMER,
},
},
},
plugins: [
openAPI(),
organization(),
],
});export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema: authSchema
}),
basePath: "/auth",
trustedOrigins: ['*'],
emailAndPassword: {
enabled: true,
},
user: {
additionalFields: {
userType: {
type: "string",
required: false,
returned: true,
defaultValue: UserType.CUSTOMER,
},
},
},
plugins: [
openAPI(),
organization(),
],
});return of signIn with email :
{
"redirect": false,
"token": "4zRj2dlQ0qkNty1oHvkT1gpCDlABrUKR",
"user": {
"id": "XEaXxiz2BzMDdfQOFbyQWsn2pSfKrtQO",
"email": "p2aco@paco.fr",
"name": "paco2",
"image": null,
"emailVerified": false,
"createdAt": "2025-11-24T10:25:44.841Z",
"updatedAt": "2025-11-24T10:25:44.841Z"
}
}{
"redirect": false,
"token": "4zRj2dlQ0qkNty1oHvkT1gpCDlABrUKR",
"user": {
"id": "XEaXxiz2BzMDdfQOFbyQWsn2pSfKrtQO",
"email": "p2aco@paco.fr",
"name": "paco2",
"image": null,
"emailVerified": false,
"createdAt": "2025-11-24T10:25:44.841Z",
"updatedAt": "2025-11-24T10:25:44.841Z"
}
}wanted return :
{
"redirect": false,
"token": "4zRj2dlQ0qkNty1oHvkT1gpCDlABrUKR",
"user": {
"id": "XEaXxiz2BzMDdfQOFbyQWsn2pSfKrtQO",
"email": "p2aco@paco.fr",
"name": "paco2",
"image": null,
"emailVerified": false,
"userType": "driver",
"createdAt": "2025-11-24T10:25:44.841Z",
"updatedAt": "2025-11-24T10:25:44.841Z"
}
}{
"redirect": false,
"token": "4zRj2dlQ0qkNty1oHvkT1gpCDlABrUKR",
"user": {
"id": "XEaXxiz2BzMDdfQOFbyQWsn2pSfKrtQO",
"email": "p2aco@paco.fr",
"name": "paco2",
"image": null,
"emailVerified": false,
"userType": "driver",
"createdAt": "2025-11-24T10:25:44.841Z",
"updatedAt": "2025-11-24T10:25:44.841Z"
}
}it's worked on get session :
{
"session": {
...
},
"user": {
"name": "paco2",
"email": "p2aco@paco.fr",
"emailVerified": false,
"image": null,
"createdAt": "2025-11-24T10:25:44.841Z",
"updatedAt": "2025-11-24T10:25:44.841Z",
"userType": "driver",
"id": "XEaXxiz2BzMDdfQOFbyQWsn2pSfKrtQO"
}
}{
"session": {
...
},
"user": {
"name": "paco2",
"email": "p2aco@paco.fr",
"emailVerified": false,
"image": null,
"createdAt": "2025-11-24T10:25:44.841Z",
"updatedAt": "2025-11-24T10:25:44.841Z",
"userType": "driver",
"id": "XEaXxiz2BzMDdfQOFbyQWsn2pSfKrtQO"
}
}