NullInjectorError:没有 StsConfigLoader 的提供程序! MSAL 角

问题描述 投票:0回答:1

我有一个角度应用程序,在其中使用 auth0 管理用户,我想更改此配置以使用身份,为此我使用 @azure/msal-angular。

我从 app.module 中删除了来自 auth0 的 AuthModule,因为现在我想使用 MsalModule,但出现以下错误:

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

NullInjectorError:没有 StsConfigLoader 的提供程序!

这是我在代码中添加的内容:

MsalModule.forRoot(
        new PublicClientApplication({
          auth: {
            clientId: "myclientId",
            authority:
              "myAuthority",
            redirectUri: "https://localhost:*PORT*/", 
          },
          cache: {
            cacheLocation: "localStorage",
            storeAuthStateInCookie: isIE,
          },
        }),
        null,
        null
      ),
angular typescript identity msal-angular
1个回答
0
投票

就我而言,我在导入中提供了 auth 模块以使其正常工作。可以在以下位置找到相同的示例:auth0-angular/examples

© www.soinside.com 2019 - 2024. All rights reserved.