refactor: rename keycloakId to authentikId in codebase
Some checks failed
Some checks failed
This commit is contained in:
parent
7eebd12699
commit
8317349507
12 changed files with 270 additions and 48 deletions
|
@ -21,8 +21,18 @@ export class UserService {
|
|||
}
|
||||
|
||||
public getOrCreateUser(profile: any): Observable<User> {
|
||||
const id = profile.info.sub;
|
||||
const username = profile.info.preferred_username;
|
||||
console.log('Full authentik profile:', profile);
|
||||
// Authentik format might differ from Keycloak
|
||||
// Check different possible locations for the ID and username
|
||||
const id = profile.info?.sub || profile['sub'];
|
||||
const username = profile.info?.preferred_username || profile['preferred_username'] || profile['email'] || profile['name'];
|
||||
|
||||
if (!id || !username) {
|
||||
console.error('Could not extract user ID or username from profile', profile);
|
||||
throw new Error('Invalid user profile data');
|
||||
}
|
||||
|
||||
console.log(`Creating user with id: ${id}, username: ${username}`);
|
||||
return this.createUser(id, username);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue