So I recently tried to update to keycloak 26.0.5. But :
import { Injectable } from “@angular/core”;
import Keycloak from “keycloak-js”;export interface UserProfile {
sub: string;
email: string;
given_name: string;
family_name: string;
token: string;
}@Injectable({ providedIn: “root” })
export class KeycloakService {
[x: string]: any;
_keycloak: Keycloak | undefined;
profile: UserProfile | undefined;get keycloak() {
if (!this._keycloak) {
this._keycloak = new Keycloak({
url: “http://localhost:8180”,
realm: “some-realm”,
clientId: “some-clients”,
});
}
return this._keycloak;
}async init() {
const authenticated = await this.keycloak.init({
onLoad: “check-sso”,
silentCheckSsoRedirectUri:
window.location.origin +/assets/silent-check-sso.html
,
});if (!authenticated) { return authenticated; } this.profile = (await this.keycloak.loadUserInfo()) as unknown as UserProfile; this.profile.token = this.keycloak.token || ""; return true;
}
login() {
return this.keycloak.login();
}//Redirect to the proper page after logout
logout() {
return this.keycloak.logout({ redirectUri: “http://localhost:4200” });
}
}
I am getting TS2307: Cannot find module keycloak-js or its corresponding type declarations.
There are types at “[FILENAME]” , but this result could not be resolved under your current moduleResolution setting. Consider updating to node16, nodenext, or bundler.
This did not happen in keycloak 25.0.0