Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to logout from Angular app once Keycloak session is terminated using keycloak-angular

I am using keycloak-angular for my login page.

If I terminate a user's session from the Keycloak's admin panel I don't receive any event when doing:

this.keycloakService.keycloakEvents$.subscribe((event: KeycloakEvent) => {
  console.log(event);
});

The user can keep using the app until he clicks the refresh button. How can I log him out immediately?

like image 909
John Doe Avatar asked Nov 18 '25 13:11

John Doe


1 Answers

i don't think this is possible. There is no WebSocket connection or equivalent open in order to get the events from the Admin page. In my opinion the only solution would to check the state periodically with a setInterval() but it's not a very elegant and performant solution

like image 113
Zerotwelve Avatar answered Nov 20 '25 03:11

Zerotwelve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!