session correction sidebar items 8
This commit is contained in:
parent
3860d8f7e7
commit
3b35c2e71a
@ -144,7 +144,7 @@ export const authOptions: NextAuthOptions = {
|
|||||||
console.log('JWT raw roles:', roles);
|
console.log('JWT raw roles:', roles);
|
||||||
|
|
||||||
// Clean up roles by removing ROLE_ prefix and converting to lowercase
|
// Clean up roles by removing ROLE_ prefix and converting to lowercase
|
||||||
const cleanRoles = roles.map(role =>
|
const cleanRoles = roles.map((role: string) =>
|
||||||
role.replace(/^ROLE_/, '').toLowerCase()
|
role.replace(/^ROLE_/, '').toLowerCase()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -158,6 +158,11 @@ export const authOptions: NextAuthOptions = {
|
|||||||
token.username = keycloakProfile.preferred_username ?? '';
|
token.username = keycloakProfile.preferred_username ?? '';
|
||||||
token.first_name = keycloakProfile.given_name ?? '';
|
token.first_name = keycloakProfile.given_name ?? '';
|
||||||
token.last_name = keycloakProfile.family_name ?? '';
|
token.last_name = keycloakProfile.family_name ?? '';
|
||||||
|
|
||||||
|
console.log('JWT callback final token:', {
|
||||||
|
tokenRoles: token.role,
|
||||||
|
token
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Date.now() < (token.accessTokenExpires as number) * 1000) {
|
if (Date.now() < (token.accessTokenExpires as number) * 1000) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user