Getting roles back from GetSession in service

I used x new for a react-lite SPA, and it generated an empty CustomUserSession : AuthUserSession, which resulted in the tables app_user, user_auth_details, and user_auth_role, I added a user using createUser with the roles array [“Admin”], when I login, I see that role coming back from API when we POST /auth, but when I use GetSession inside a service, roles is not populated.


If your roles are stored in a distinct table you’ll need to use the IAuthRepository to resolve them which you can do with:

var roles = session.GetRoles(AuthRepository);

var roles = await session.GetRolesAsync(AuthRepositoryAsync);