Angular 8 - How to store/use Access and Refresh token

Hello, I have trouble understanding where should I store the access/refresh token for future remote HttpClient calls.
For integrating keycloak I followed the steps here: To my understanding, all calls should have in header bearer token but it is only added in the keycloak endpoints for token, account and userinfo.
My question is what is the way of getting and using the access token, should it be stored somewhere right after the login or am I doing something wrong during integration?
Here is the initializer function:

Seems you’re missing a configuration line, take a look at, especially the enableBearerInterceptor: true which will add the interceptor for you.

I don’t know if you even need that line because it’s active by default.
Maybe you can put your example on git so we can take a look what’s missing.

Unfortunately I couldn’t expose the code however I found out what the problem was. The token was not added in submodules where HttpClient requests were made. So I had to make the requests inside the module where keycloak is loaded so the token is automatically added to the header of each call.

Seems a strange solution to your problem.
I’m just curious now, do you require an authenticated user for the application or are some modules available for public users?
normally you setup the APP_INITIALIZER in the providers of the root app module and all http requests would add the token, no matter which module you do calls from and no matter if they are lazy loaded or not.

I had another module for testing purpuses. For some reason it doesn’t work for submodules so I reduced the app to a single module. I found a similar problem in this open issue:

I’m not experiencing this issue. Maybe it has to do with the following comment made in that issue.

It turned out to be that I was initialising keycloak in another module than where I import the HttpClientModule

Oh, I see. It could be that I didn’t import the HttpClientModule in the primary module. Thank you!