如何解决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 可跨所有网络(域和非域网络)访问
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。