keycloak-angular for angular 8 code example
Example: Angular Application using KeyCloak
private keycloakAuth: any;init(): Promise<any> { return new Promise((resolve, reject) => { const config = { 'url': 'http://localhost:8888/auth', 'realm': 'example', 'clientId': 'js-console' }; this.keycloakAuth = new Keycloak(config); this.keycloakAuth.init({ onLoad: 'login-required' }) .success(() => { resolve(); }) .error(() => { reject(); }); });}getToken(): string { return this.keycloakAuth.token;}