role field doesn't show up on sign in but shows up on session

I have added returned. role doesn't show on sign in but role shows on get session

export const auth = betterAuth({
  database: prismaAdapter(prisma, {
    provider: "postgresql",
  }),
  plugins: [admin(), openAPI()],
  trustedOrigins: appConfig.CORS_ORIGINS,
  emailAndPassword: {
    enabled: true,
    requireEmailVerification: false,
    sendResetPassword: async ({ user, url }) => {
      await NotifyService.sendResetPasswordEmail(user.email, url, {
        username: user.name || user.email.split("@")[0],
      });
    },
    autoSignIn: true,
  },
  account: {
    accountLinking: {
      enabled: true,
      trustedProviders: ["google"],
    },
  },
  user: {
    additionalFields: {
      role: {
        type: "string",
        input: false,
        required: false,
        defaultValue: "user",
        returned: true, // add this line
      },
    },
  },
  socialProviders: {
    google: {
      clientId: appConfig.GOOGLE_CLIENT_ID,
      clientSecret: appConfig.GOOGLE_CLIENT_SECRET,
    },
  },
  emailVerification: {
    expiresIn: 60 * 60, // 1h expires in
    sendOnSignUp: true,
    sendVerificationEmail: async ({ user, url }) => {
      await NotifyService.sendVerificationEmail(user.email, url, {
        username: user.name || user.email.split("@")[0],
      });
    },
  },
});


Here i have returned: true but still don't get the role on sign in.

"better-auth": "^1.3.34"

below is the user object on sign in response
"user": {
"id": "uUqBJQSZGgzipABOPKNetFRhOBI65TFC",
"email": "**",
"name": "**",
"image": "",
"emailVerified": false,
"createdAt": "2025-10-31T11:30:56.117Z",
"updatedAt": "2025-10-31T11:30:56.117Z"
}
Was this page helpful?