Adding Roles to Your Session
Extend the Auth.js session type to include a role field populated from your database. Check session.user.role in middleware, Server Components, and Server Actions to gate access at every layer.
Extend the Auth.js session type to include a role field populated from your database. Check session.user.role in middleware, Server Components, and Server Actions to gate access at every layer.