msal和angular 4重定向Url
发布时间:2020-12-17 18:06:38 所属栏目:安全 来源:网络整理
导读:我正在使用msal.js来验证用户身份.我成功获得了令牌.在azure portal的redirectURl中,我将路径指定为“ http://localhost:44340”. 我的app.routing模块如下所示: const routes: Routes = [ { path: 'authentication',component: LoginComponent },{ path: '
我正在使用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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |