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