Repository navigation
[Keycloak angular] How to trigger Keycloak login in a route guard using provideKeycloak (without deprecated KeycloakService) #40080
Unanswered
bartoszgebka
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
I’ve recently migrated to the latest version of keycloak-angular and noticed that KeycloakService is now deprecated. I'm using provideKeycloak for setup, which works fine for most things — but I’m struggling with one specific use case.
Previously, in a route guard (CanActivate), I could inject KeycloakService and call login() if the user wasn't authenticated:
Now that KeycloakService is deprecated, how should I trigger the login process from a route guard?
What’s the best practice for this?
All reactions