The lazy loaded module is protected by AuthGuard from “@auth0/auth0-angular”;
I have also added this to my lazy loaded module file to try and get the AuthGuard to add the token.
{provide: HTTP_INTERCEPTORS, useClass: AuthHttpInterceptor, multi: true}
But the token is missing in the lazy loaded module’s service request?
In my lazy loaded module I needed to have these declarations for the token to be added.
providers: [
// Auth0 interceptor that is not getting called.
// Interestingly if you remove this interceptor the token never gets fetched.
{provide: HTTP_INTERCEPTORS, useClass: AppHttpInterceptor, multi: true},
// My custom interceptor to add the token.
{provide: HTTP_INTERCEPTORS, useClass: AuthHttpInterceptor, multi: true},