pan*_*kaj 6 azure-ad-msal angular
我正在使用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 { }
Run Code Online (Sandbox Code Playgroud)
我的问题是当用户登录时我得到令牌并且当redirecturi到达'/ lists'时.我有一个gaurd.在gaurd的一侧,由于页面未重定向,因此尚未设置标记值.这就是为什么它一直都是假的,我被重定向回登录页面.
小智 -2
建议使用 GitHub 上的 Angular MSAL 库示例实现:
npm install @azure/msal-angular --save
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
724 次 |
| 最近记录: |