【发布时间】:2018-01-01 00:19:36
【问题描述】:
我正在使用带有 Angular 4 应用程序的隐式流的 Azure AD。我的 NG4 应用程序使用 PathLocationStrategy 进行路由,以便它可以利用干净的 url。我的 AAD 身份验证请求如下所示:
授权通过,我被重定向到http://localhost:4200/login#id_token=xxxxx,然后被重定向到http://localhost:4200/home#id_token=xxxxx
我的路线如下所示:
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{
path: '', component: BlankLayoutComponent,
children: [
{ path: 'login#id_token=:id_token', component: LoginComponent }
]
},
{
path: '', component: BasicLayoutComponent,
children: [
{ path: 'home', component: StarterViewComponent }
]
},
// Handle all other routes
{ path: '**', redirectTo: 'home' }
我似乎无法配置从 url 获取 id_token 的路由,因此我可以使用它来授权其他请求。如何从重定向中取回这个 id_token?
【问题讨论】:
-
你是在问如何从activatedRoute获取片段?
-
这可以工作,但我的路线缺少登录路线并重定向到家。
-
嗨 Darthg8r,您在 angular4 中使用什么包来连接 AAD?我尝试使用 ng2-adal,但遇到 Angular 4.4.3 的“找不到模块”问题。
标签: angular azure-active-directory openid-connect