Use Keycloak config endpoint in production (#3471)

This commit is contained in:
Jon Koops 2022-10-03 19:02:13 +02:00 committed by GitHub
parent 3694dad23c
commit 6a75c6da6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,14 +71,21 @@ export function useFetch<T>(
}, deps);
}
export async function initAdminClient() {
const keycloak = new Keycloak({
function getKeycloakConfig() {
if (environment.isRunningAsTheme) {
return environment.consoleBaseUrl + "config";
}
return {
url: environment.authServerUrl,
realm: environment.loginRealm,
clientId: environment.isRunningAsTheme
? "security-admin-console"
: "security-admin-console-v2",
});
clientId: "security-admin-console-v2",
};
}
export async function initAdminClient() {
const config = getKeycloakConfig();
const keycloak = new Keycloak(config);
await keycloak.init({ onLoad: "check-sso", pkceMethod: "S256" });