Angular StaticInjectorError(AppModule)[MsalGuard->;路由器]
我已经用爱奥尼亚创建了一个网络应用程序。我正在尝试将MSALModule导入我的应用程序。根据我在网上找到的教程等,您必须在应用程序模块中添加以下内容:Angular StaticInjectorError(AppModule)[MsalGuard->;路由器],angular,microsoft-graph-api,ionic4,angular-router,msal,Angular,Microsoft Graph Api,Ionic4,Angular Router,Msal,我已经用爱奥尼亚创建了一个网络应用程序。我正在尝试将MSALModule导入我的应用程序。根据我在网上找到的教程等,您必须在应用程序模块中添加以下内容: MsalModule.forRoot({ clientID: OAuthSettings.appId }), 目前,当我尝试转到使用它的页面时,它会给我以下错误 We have a generic Error: Error: Uncaught (in promise): Error: StaticInjectorErro
MsalModule.forRoot({
clientID: OAuthSettings.appId
}),
目前,当我尝试转到使用它的页面时,它会给我以下错误
We have a generic Error: Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[MsalGuard -> Router]:
StaticInjectorError(Platform: core)[MsalGuard -> Router]:
NullInjectorError: No provider for Router!
Error: StaticInjectorError(AppModule)[MsalGuard -> Router]:
StaticInjectorError(Platform: core)[MsalGuard -> Router]:
NullInjectorError: No provider for Router!
at _NullInjector.get (core.js:994)
at resolveToken (core.js:1292)
at tryResolveToken (core.js:1234)
at StaticInjector.get (core.js:1102)
at resolveToken (core.js:1292)
at tryResolveToken (core.js:1234)
at StaticInjector.get (core.js:1102)
at resolveNgModuleDep (core.js:10847)
at _createClass (core.js:10888)
at _createProviderInstance$1 (core.js:10858)
at c (polyfills.js:3)
at Object.reject (polyfills.js:3)
at NavControllerBase._fireError (nav-controller-base.js:223)
at NavControllerBase._failed (nav-controller-base.js:216)
at nav-controller-base.js:263
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.js:4733)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
我没有导入路由模块,因为我没有在应用程序中使用角度(或离子)路由。有没有一种方法可以在不使用路由的情况下消除此错误?i、 e.我可以使用MSAL而不在我的应用程序中设置路由吗?我看到您有导入声明…您是否添加到“提供程序”部分: {提供:HTTP_拦截器,useClass:MsalInterceptor,multi:true}
我的理解是,这不是绝对必要的,只要你有一个定制的提供者,你已经开发。但是,如果这不存在,你需要在你的提供者部分有这个 您能将“路由器”添加到服务阵列并尝试吗?@ppgowda4您的意思是什么?MSAL需要路由模块。你需要导入that@ppgowda4我试图使用msal,因为我试图通过向授权端点(graph api的隐式流)发送get请求来获取访问令牌,但返回的令牌无效。你知道为什么吗?如果有帮助,你可以检查这个问题