如何解决MSAL 身份验证:POST 请求正文中缺少 401 和 client_assertion' 或 'client_secret'
我在调用 login() 函数时遇到 2 个不同的错误,如下所示:
login() {
if (this.msalGuardConfig.interactionType === InteractionType.Popup) {
if (this.msalGuardConfig.authRequest){
this.authService.loginPopup({...this.msalGuardConfig.authRequest} as PopupRequest)
.subscribe(() => this.checkAccount());
} else {
this.authService.loginPopup()
.subscribe(() => this.checkAccount());
}
} else {
if (this.msalGuardConfig.authRequest){
this.authService.loginPopup({...this.msalGuardConfig.authRequest} as RedirectRequest);
} else {
this.authService.loginPopup();
}
}
}
我几乎从这个 repo 复制了身份验证流程:https://github.com/Azure-Samples/ms-identity-javascript-angular-spa-aspnetcore-webapi 这是正式来自 Azure,我设置了所有内容,就像他们在自述文件的设置部分所做的那样。因此,app.module.ts
和 app.component.ts
看起来当然与我的租户和 clientID 的替换环境变量相同。我也使用了相同的包版本(msal-angular@^2.0.0-alpha.3)。
如果您对这些错误有任何提示或想法,我们将不胜感激。 提前致谢!
解决方法
要解决此错误,您需要在 Azure 门户中将应用中使用的重定向 URI 设置为“单页应用程序”类型。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。