В конце концов, я реализовал функцию единого входа, используя библиотеку Angular-OIDC (неявный поток) https://github.com/manfredsteyer/angular-oauth2-oidc
private configureWithNewConfigApi() {
// URL of the SPA to redirect the user to after login
this.oauthService.redirectUri = window.location.origin + "/index.html";
// set the scope for the permissions the client should request
this.oauthService.scope = "openid profile email";
// set to true, to receive also an id_token via OpenId Connect (OIDC) in addition to the
// OAuth2-based access_token
this.oauthService.oidc = true;
// Use setStorage to use sessionStorage or another implementation of the TS-type Storage
// instead of localStorage
this.oauthService.setStorage(sessionStorage);
this.oauthService.clientId = "<<clientId>>";
let url = 'https://<<keycloakhost>>:<<port>>/auth/realms/<<realmsname>>/.well-known/openid-configuration';
this.oauthService.loadDiscoveryDocument(url).then((doc) => {
// This method just tries to parse the token within the url when
// the auth-server redirects the user back to the web-app
// It dosn't initiate the login
this.oauthService.tryLogin({});
console.debug('discovery succeeded', doc);
});
Спасибо Ян Гараг за ваше предложение