Skip to content

Commit

Permalink
fix(backend): Keycloak auth errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Clashsoft committed Aug 25, 2024
1 parent c54fde2 commit a9bc3ab
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions apps/backend/src/auth/keycloak.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ export class KeycloakService {
baseUrl: environment.keycloak.baseUrl,
realmName: environment.keycloak.realmName,
});
await kcAdminClient.auth({
grantType: 'password',
username: environment.keycloak.adminUser,
password: environment.keycloak.adminPassword,
clientId: environment.keycloak.clientId,
clientSecret: environment.keycloak.clientSecret,
});
try {
await kcAdminClient.auth({
grantType: 'password',
username: environment.keycloak.adminUser,
password: environment.keycloak.adminPassword,
clientId: environment.keycloak.clientId,
clientSecret: environment.keycloak.clientSecret,
});
} catch (err) {
console.error(err);
return;
}
return kcAdminClient.users.findOne({id});
}
}

0 comments on commit a9bc3ab

Please sign in to comment.