diff --git a/frontend/src/app/service/user.service.ts b/frontend/src/app/service/user.service.ts index 3c64e34..4a0d781 100644 --- a/frontend/src/app/service/user.service.ts +++ b/frontend/src/app/service/user.service.ts @@ -48,12 +48,12 @@ export class UserService { // Authentik format might differ from Keycloak // Check different possible locations for the ID and username const info = profile['info'] as Record | undefined; - const id = info?.['sub'] as string || profile['sub'] as string; + const id = (info?.['sub'] as string) || (profile['sub'] as string); const username = - info?.['preferred_username'] as string || - profile['preferred_username'] as string || - profile['email'] as string || - profile['name'] as string; + (info?.['preferred_username'] as string) || + (profile['preferred_username'] as string) || + (profile['email'] as string) || + (profile['name'] as string); if (!id || !username) { console.error('Could not extract user ID or username from profile', profile);