Giter Club home page Giter Club logo

Comments (4)

mauriciovigolo avatar mauriciovigolo commented on September 4, 2024

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:

  1. Use a different path for this page and add it to the bearerExcludedUrls. For example: main or another path.
  2. 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.

velorium-star avatar velorium-star commented on September 4, 2024

@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.

mauriciovigolo avatar mauriciovigolo commented on September 4, 2024

@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.

velorium-star avatar velorium-star commented on September 4, 2024

@mauriciovigolo Perfect. I went through the code in the meanwhile. Everything is clear now. Thanks!

from keycloak-angular.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.