首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Msal-angular总是打开弹出窗口,而我更喜欢重定向

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

Stack Overflow用户
提问于 2020-04-01 21:51:12
回答 1查看 320关注 0票数 0

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

代码语言:javascript
复制
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)的登录页面,但我总是得到一个弹出窗口。在这种情况下,我想通过重定向进行身份验证。

EN

回答 1

Stack Overflow用户

发布于 2020-04-01 22:02:10

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

代码语言:javascript
复制
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是假的,所以它做了弹出登录。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60972440

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档