NullInjectorError: No provider for StsConfigLoader! MSAL angular

74 views Asked by At

I have an angular application in which I am managing users with auth0, I want to change this configuration to use identity and for this I am using @azure/msal-angular.

I removed the AuthModule that comes from auth0 from my app.module, since now I want to use the MsalModule, but I am having the following error:

main.ts:11 ERROR NullInjectorError: R3InjectorError(AppModule)[ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> AppConfigService -> OidcSecurityService -> CheckAuthService -> PeriodicallyTokenCheckService -> ConfigurationService -> StsConfigLoader -> StsConfigLoader -> StsConfigLoader]: 

NullInjectorError: No provider for StsConfigLoader!

This is what I added in my code:

MsalModule.forRoot(
        new PublicClientApplication({
          auth: {
            clientId: "myclientId",
            authority:
              "myAuthority",
            redirectUri: "https://localhost:*PORT*/", 
          },
          cache: {
            cacheLocation: "localStorage",
            storeAuthStateInCookie: isIE,
          },
        }),
        null,
        null
      ),
1

There are 1 answers

0
Chandra Prakash Ajmera On

In my case I have provided auth module in the imports in order to make it work. An example for the same can be found at: auth0-angular/examples