I am using the current beta version
“next-auth”: “5.0.0-beta.20”
I have extended the user database entity to include a role.
I have extended the callback:
callbacks: {
//usually not needed bug in nextAuth
async session({ session, user }: any) {
if (session && user) {
session.user.id = user.id;
session.user.role = user.role;
}
return session;
},
},
When I use
const session = useSession();
const user = session.data?.user;
The variable user does not have the role attribute.
Please let me know how to get role included in the user type?
Many thanks,