Msal angular总是打开弹出窗口,而我更喜欢重定向



在我的app.module.ts中,我有msal angular的配置:

imports: [
BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
HttpClientModule,
FormsModule,
RouterModule.forRoot([
{ path: '', component: HomeComponent, pathMatch: 'full' },
{ path: 'ms-profile', component: MsProfileComponent, canActivate: [ MsalGuard ] }
]),
RouterModule,
MsalModule.forRoot({
auth: {
clientId: '7be72f7e-2433-4ef8-b1c7-9b1c91514659',
authority: 'https://login.microsoftonline.com//d566b150-219d-4312-ba59-3dca2f84a2ac',
validateAuthority: true,
redirectUri: 'http://localhost:4200/',
postLogoutRedirectUri: 'http://localhost:4200/',
navigateToLoginRequestUrl: true
}
}
)
]

通常(根据文档(我应该重定向到aad(Azure Active Directory(的登录页面,但我总是会弹出一个窗口。在这种情况下,我想通过重定向进行身份验证。

显然这不是配置问题,而是我登录用户的方式:

login() {
this.authService.loginRedirect();
// const isIE = window.navigator.userAgent.indexOf('MSIE ') > -1 || window.navigator.userAgent.indexOf('Trident/') > -1;
// if (isIE) {
//   this.authService.loginRedirect();
// } else {
//   this.authService.loginPopup();
// }
}

由于isIE在我的情况下是false,所以它进行了弹出登录。

最新更新