x)- [x] bug report -> please search for issues before submitting
- [ ] feature request
When i refresh the page, the keycloak-angular redirect me to the redirectUri and not keep the last url. Any idea why is this happens?
@nikosvr88 Did you solve the issue?
I have the same problem. Upon first visit I get redirected to keycloak as expected, the login works and I'm on the protected part of my page /dashboard.
But if I refresh that frontend page now, it redirects to keycloak again, passing "my.domain.com/dashboard" to keycloak as redirect url...
I'm having the same question/issue. My integration keycloak/angular app works as expected, I can log in and get redirected to route /a but when I change between routes, let's say route /b and I refresh my page, I get again redirected to /a instead of the current url.
All the functionalities are working like a charm except for that part.
Awesome job you are doing btw :)
I had the same issue and got it fixed by setting the redirectUri in the keycloak login function to "window.location.href" (I have the login within the isAccessAllowed function in KeycloakAuthGuard).
Hope that helps someone
@theJazzman ,
Sorry can you be more clear, i am having the same issue, after logging out and again logging in, i am getting redirected to same url which i was on before logging, when observed, there is query param with redirect uri. Can you please be more appropriate.
Thanks
I am currently unable to reproduce this particular issue in any of my apps. Would it be possible for someone to provide a reproducible example?
@jonkoops
Im getting the same error after using use hash strategy {provide: LocationStrategy, useClass: HashLocationStrategy}
I think keyclock breaks the url from the first # and redirect to base url
As an example http://localhost:4200/#/post-sale/home after keyclock authentication it redirects back to http://localhost:4200
If i remove hash strategy then it works perfectly.
@prabath95 Ok, yes that makes a lot of sense. Keycloak depends on the hash to transfer the access token to the client. Angular will treat that hash as a route and perhaps since it does not recognize it it redirects the client to a different page.
To resolve this it's possible to use silentCheckSsoRedirectUri which does this process in an iframe instead of hijacking the URL. This feature will be included in the next release of Keycloak Angular, I'll make sure to document this case as well.
@jonkoops Thanks a lot when will be the next version releases?
@prabath95 It's out since yesterday, could you try out version 7.1.0 in combination with Keycloak 8.0.1? It should be possible to pass silentCheckSsoRedirectUri into the options when initializing Keycloak. For more information see the documentation.
@jonkoops Can you please provide an example with "silentCheckSsoRedirectUri" then that will be easy.
A complete example of how to use silentCheckSsoRedirectUri is now available in our README, this will prevent any weird page refreshes from happening.
Most helpful comment
@jonkoops Can you please provide an example with "silentCheckSsoRedirectUri" then that will be easy.