Better Auth · Function
customSession
The customSession plugin lets you add or change fields returned by getSession and useSession. Use customSessionClient to expose the added fields to client-side types.
Last updated
Syntax
customSession(async ({ user, session }, ctx) => ({ user, session, ...customFields }), options, pluginOptions)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
getSessionuseSessioncustomSessionClientmulti-session/list-device-sessionsshouldMutateListDeviceSessionsEndpointBetterAuthOptions