Comments (4)
Hi @velorium-star,
Great that you are trying the library! So straight to the answers 😄 :
- Do you have any idea what could be the cause? Why is it necessary to give bearerExcludedUrls to avoid being redirected immediately to the keycloak?
Every time the bearer is added to the http request, the flow updates the token in order to refresh it. When updating, it will check if you are logged in and will redirect the user to the login page, because you are not logged in yet.
If a path is included in the bearerExcludedUrls, if the given url matches it, the token will not be refreshed because the interceptor will terminate the add bearer to header flow before and continue the request.
In your case, you added path /
. Every url has /
so all paths were excluded.
So try these options:
- Use a different path for this page and add it to the bearerExcludedUrls. For example: main or another path.
- The second option is to not use the keycloak-angular interceptor and add the bearer to your requests. In this case you could still use the
/
, but in every request you have to call the keycloak-angular method: KeycloakService#addTokenToHeader(headersArg?: HttpHeaders)
Thanks
from keycloak-angular.
@mauriciovigolo thanks for quick response.
OK, now it's clear. The only thing that bothers me is that url matching. If I understood you correctly if I exclude for example '/page' it will match '/page' but '/page/one' and '/page/one/two' also?
from keycloak-angular.
@velorium-star, as it is a regex, you may append $
to the end of your text, for example: /page$. In this example it will only match the url that finishes with '/page'.
from keycloak-angular.
@mauriciovigolo Perfect. I went through the code in the meanwhile. Everything is clear now. Thanks!
from keycloak-angular.
Related Issues (20)
- Server-side rendering (SSR) crash with 'Document not found' error in Keycloak-angular with Angular 17 HOT 10
- keycloakBearerInterceptorFn example HOT 1
- Login method locale is not changing the user locale when the user logs in
- angular crashes with check-sso
- Support KC 24.x.x HOT 6
- Catch sign out event or redirect to ssop event
- keycloak-angular - next version improvements HOT 1
- Bug in package.json version 15.2.0 HOT 3
- Keycloak setup for Single SPA angular Project
- HttpClient Interceptor not working HOT 2
- Configure updateToken minValidity in HTTP Interceptor
- Standalone bootstrap: withEnabledBlockingInitialNavigation() causes isLoggedIn() to return false in AuthGuard HOT 2
- Add setup instructions for standalone bootstrap
- Logout the user if he is idle
- Support Angular v18 HOT 2
- Token refresh fails with 400 invalid_grant Token is not active HOT 2
- If Keycloak Auth Domain is down, then Angular 16 keycloak will receive white-page and fail compilation at AppModule level
- Refresh Token is unused HOT 2
- ERROR Error: An error happened during access validation. Details:TypeError: Cannot read properties of undefined (reading 'resourceAccess') HOT 3
- Support Keycloak 25.x.x HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keycloak-angular.