Get access to genericOAuth profile in customSession
Hi everyone, I have some user groups in keycloak and want to pass them to session.user.
The groups are in the genericOAuth profile, as passed to mapProfileToUser. How can I access profile.groups from customSession?
Thanks!
3 Replies
you can query the accounts table and read the profiel from the
idToken
or you can store it in the user table as an additional field and when you do map profile it'll be stored in that fieldThanks for helping. For some reason user
additionalFields
are not added to the session.user object if I don't use customSession.
So not really sure what to do. I am working with Next.js server side, [email protected]check how to infer additional fields on the client
https://www.better-auth.com/docs/concepts/typescript#inferring-additional-fields-on-client
TypeScript | Better Auth
Better Auth TypeScript integration.