Azure AD with Angular 4 -
i'm using azure ad implicit flow angular 4 app. ng4 app using pathlocationstrategy routing can take advantage of clean urls. aad auth request looks this:
the authorization passes , i'm redirected http://localhost:4200/login#id_token=xxxxx gets redirected http://localhost:4200/home#id_token=xxxxx
i have routes looks this:
{ 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 other routes { path: '**', redirectto: 'home' }
i can't seem route configured grab id_token url can use authorizing other requests. how can id_token redirection?
in component starterviewcomponent , implement interface oninit , write in method ngoninit.
export class starterviewcomponent implements oninit { ngoninit() { if (window.location.hash) { this.someloginservice.validatetoken(window.location.hash); } } }
Comments
Post a Comment