如何解决@ azure / msal-angular 1.1.1具有TypeError:需要全局模式字符串
在ng serve --aot
进行提示后,升级到@azure/msal-angular 1.1.1
和msal 1.4.0
后在https://www.npmjs.com/package/@azure/msal-angular
中运行时,我的Angular 8出现以下错误。
TypeError: glob pattern string required
at new Minimatch (minimatch.js:116)
at azure-msal-angular.js:213
at Array.filter (<anonymous>)
at MsalService.push../node_modules/@azure/msal-angular/fesm5/azure-msal-angular.js.MsalService.getScopesForEndpoint (azure-msal-angular.js:212)
at MsalInterceptor.push../node_modules/@azure/msal-angular/fesm5/azure-msal-angular.js.MsalInterceptor.intercept (azure-msal-angular.js:367)
at HttpInterceptorHandler.push../node_modules/@angular/common/fesm5/http.js.HttpInterceptorHandler.handle (http.js:1279)
at HttpXsrfInterceptor.push../node_modules/@angular/common/fesm5/http.js.HttpXsrfInterceptor.intercept (http.js:1888)
at HttpInterceptorHandler.push../node_modules/@angular/common/fesm5/http.js.HttpInterceptorHandler.handle (http.js:1279)
at HttpInterceptingHandler.push../node_modules/@angular/common/fesm5/http.js.HttpInterceptingHandler.handle (http.js:1932)
at MergeMapSubscriber.project (http.js:1099)
与ng serve
请问有什么主意吗?
解决方法
如果我创建protectedResourceMap
的地图,这是可行的
const protectedResourceMap: [string,string[]][] = [
[config.api,[environment.msScope]],["https://graph.microsoft.com/v1.0/me",["user.read"]],["https://graph.microsoft.com/beta/me",["https://graph.microsoft.com/v1.0/users",["directory.read.all"]],["https://graph.microsoft.com/v1.0/groups",];
在
MsalModule.forRoot(
{
...
protectedResourceMap: new Map(protectedResourceMap),}
),],
但是MsalInterceptor无法将令牌注入到api调用中。
已修复:MsalModule初始化后,我的cofig值可用,因此Msal配置为空=> glob错误。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。