msal和angular 4重定向Url

前端之家收集整理的这篇文章主要介绍了msal和angular 4重定向Url前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用msal.js来验证用户身份.我成功获得了令牌.在azure portal的redirectURl中,我将路径指定为“ http://localhost:44340”.

我的app.routing模块如下所示:

const routes: Routes = [
  { path: 'authentication',component: LoginComponent },{ path: '',redirectTo: '/lists',pathMatch: 'full',canActivate: [AuthenticationGuard] },{ path: 'lists',component: ApplicationContainer,canActivate: [AuthenticationGuard]}
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],exports: [RouterModule]
})
export class AppRoutingModule { }

我的问题是当用户登录时我得到令牌并且当redirecturi到达’/ lists’时.我有一个gaurd.在gaurd的一侧,由于页面重定向,因此尚未设置标记值.这就是为什么它一直都是假的,我被重定向登录页面.

解决方法

建议在GitHub上使用角度MSAL库示例实现:

npm install @azure/msal-angular --save

猜你在找的Angularjs相关文章