keycloak.init.ts
import { KeycloakService } from "keycloak-angular";

export function initializeKeycloak(keycloakService: KeycloakService) {
  return () =>
    keycloakService.init({
      config: {
        url: "http://localhost:8080" + "/auth",
        realm: "myAppRealm",
        clientId: "myApp",
      },
      initOptions: {
        onLoad: 'check-sso',
        silentCheckSsoRedirectUri:
          window.location.origin + '/assets/silent-check-sso.html'
      }
    });
}