Keycloak-angular: interceptor keycloack does not work

Created on 14 Mar 2018  路  3Comments  路  Source: mauriciovigolo/keycloak-angular

I have a problem with the interceptor, it does not add the Authorization Bearer header, it adds it well for keycloack requests exepmle: http: // awl-si-cap-keycloack3: 8080 / auth / realms / realm / account
but not for my queries coming out of my application, example : getUser

Any suggestion. Thank you

Question

Most helpful comment

I just ran into the same problem. Check your module imports. There must be only one HttpClientModule, typically in the app.module.

If imported anywhere else, remove it. It should work then. This is related to the behavior of HttpClientModule.

All 3 comments

Hello @ayoubnejm,

I need more information about your scenario. Please let me know the angular version you are using in your project and your keycloak-angular init configuration.

To work the interceptor requires the use of angular's HttpClient. Are you using it in your requests?

I just ran into the same problem. Check your module imports. There must be only one HttpClientModule, typically in the app.module.

If imported anywhere else, remove it. It should work then. This is related to the behavior of HttpClientModule.

@ayoubnejm,

I'm closing this issue since it may be related to HttpClient or the module imports of HttpClientModule as reported by @nconcetti, thanks for your feedback @nconcetti!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arratejasvi picture arratejasvi  路  4Comments

nfriend picture nfriend  路  4Comments

4javier picture 4javier  路  3Comments

samherrmann picture samherrmann  路  3Comments

Bjeaurn picture Bjeaurn  路  4Comments