Add id of relation to user obj
Is it possible to access the company id in the session user?
Solution:Jump to solution
Hello, you need to define an additional field in your auth config:
https://www.better-auth.com/docs/concepts/typescript#additional-fields
Then, you can access it via the customSession plugin:
https://www.better-auth.com/docs/concepts/session-management#customizing-session-response...
TypeScript | Better Auth
Better Auth TypeScript integration.
Session Management | Better Auth
Better Auth session management.
1 Reply
Solution
Hello, you need to define an additional field in your auth config:
https://www.better-auth.com/docs/concepts/typescript#additional-fields
Then, you can access it via the customSession plugin:
https://www.better-auth.com/docs/concepts/session-management#customizing-session-response
TypeScript | Better Auth
Better Auth TypeScript integration.
Session Management | Better Auth
Better Auth session management.