2020-09-01 14:51:59 +00:00
|
|
|
import Keycloak, { KeycloakInstance } from "keycloak-js";
|
2020-10-26 08:00:05 +00:00
|
|
|
|
|
|
|
const realm =
|
|
|
|
new URLSearchParams(window.location.search).get("realm") || "master";
|
|
|
|
|
|
|
|
const keycloak: KeycloakInstance = Keycloak({
|
|
|
|
url: "http://localhost:8180/auth/",
|
|
|
|
realm: realm,
|
|
|
|
clientId: "security-admin-console-v2",
|
|
|
|
});
|
2020-08-04 12:59:41 +00:00
|
|
|
|
|
|
|
export default async function (): Promise<KeycloakInstance> {
|
2020-09-01 14:51:59 +00:00
|
|
|
await keycloak.init({ onLoad: "check-sso", pkceMethod: "S256" }).catch(() => {
|
|
|
|
alert("failed to initialize keycloak");
|
2020-08-06 08:51:35 +00:00
|
|
|
});
|
2020-08-04 12:59:41 +00:00
|
|
|
return keycloak;
|
|
|
|
}
|