Save keycloak token in localstorage
MODIFY
src/app/app-init.ts
src/app/app-init.ts
@@ -9,9 +9,15 @@ export function initializer(keycloak: KeycloakService): () => Promise<any> {
},
initOptions: {
onLoad: 'login-required',
- checkLoginIframe: false
+ checkLoginIframe: false,
+ token: localStorage.getItem('apiman_keycloak_token'),
+ refreshToken: localStorage.getItem('apiman_keycloak_refresh_token')
},
enableBearerInterceptor: true,
bearerExcludedUrls: ['/assets', '/clients/public']
+ }).then(success => {
+ const keycloakInstance = keycloak.getKeycloakInstance();
+ localStorage.setItem('apiman_keycloak_token', keycloakInstance.token);
+ localStorage.setItem('apiman_keycloak_refresh_token', keycloakInstance.refreshToken);
});
}

Save keycloak token in localstorage