angular - hVD(虚拟机)上的 Msal 库登录错误
问题描述
嗨,伙计们,我正在使用 MSAL 库进行 SSO 身份验证,它在本地计算机上完美运行,但是当我在同一台笔记本电脑上的 HVD(虚拟机)上尝试它时,即 HVD 具有不同的域
,我收到以下错误。
MSAL 版本 --> "msal": "^1.4.5"
profile;
isIframe = false;
loggedIn = false;
private readonly _destroying$ = new Subject<void>();
constructor(
@Inject(MSAL_GUARD_CONFIG) private msalGuardConfig: MsalGuardConfiguration,
private authService: MsalService,
private msalBroadcastService: MsalBroadcastService,
private http: HttpClient,
private componentService: ComponentService
) { }
ngOnInit(): void {
this.authService.handleRedirectObservable().subscribe({
next: (result: AuthenticationResult) => {
this.getProfile();
},
error: (error) => console.log(error)
});
this.isIframe = window !== window.parent && !window.opener;
}
login() {
if (this.authService.instance.getAllAccounts().length > 0) {
console.log("already logged in");
this.getProfile();
} else {
if (this.msalGuardConfig.authRequest) {
this.authService.loginRedirect({ ...this.msalGuardConfig.authRequest });
} else {
this.authService.loginRedirect();
}
}
}
getProfile() {
this.http.get(GRAPH_ENDPOINT).subscribe(profile => {
this.profile = profile;
console.log(this.profile);
this.componentService.setCorpIdFromProfile(profile);
}, error => {
console.log(error);
});
}
s
logout() {
this.authService.logout();
}
ngOnDestroy(): void {
this._destroying$.next(null);
this._destroying$.complete();
}
}
我不知道我做错了什么,任何帮助将不胜感激。
谢谢
解决方案
如果您使用的是第 3 方 IdP(如 ADFS 等),如果第 3 方 iDP 在域网络之外无法访问。这很可能发生。确保可以跨所有网络(域和非域网络)访问第 3 方 IdP
推荐阅读
- html - Aspose HTML to RTF转换添加空白列表元素
- php - 使用诸如资产之类的树枝属性在带有占位符值的jQuery中不起作用
- database - MongoDB 从指定版本中获取最新版本
- curve - 如何在 OpenSCAD 中制作曲面片(立方体)?
- wolfram-mathematica - 如何导入一个文本文件,并将mathematica中的所有内容进行导入?
- javascript - 尝试在数据库中访问和设置外键时遇到问题
- python - 必须是 unicode 而不是 python 2 上的字符串
- nginx - nginx 中的位置块没有得到预期的结果 - 也许是订购?
- html - How to link my CSS to my HTML in a github hosted site
- powershell - jar 文件的版本,通过使用 powershell 读取其清单