Getting parameters from external redirect in Angular 4

I am building an Angular 4 app that redirects to Azure Active Directory for authentication, however I am having a problem getting the returned token from Microsoft.

I have route setup as follows

export const ROUTES:Routes = [
  { 
    path: '', redirectTo: 'login', pathMatch: 'full'
  },
  {
    path: 'access_token', component: LoginCallbackComponent
  }

      

Going to http: // localhost: 4200 takes me to the login page

When I click the Sign In button, I am redirected to Microsoft and the authentication happens through Azure AD. After successful Authentication, Microsoft redirects me back to the application with the following

http: // localhost: 4200 / # access_token = eyJ0eXAiOiJKV1QiLCJhbGciOiJSU ..... etc ... etc ...

Route 'access_token' calls LoginCallbackComponent correctly, but I cannot find the value of access_token in LoginCallbackComponent

ActivatedRoute.snapshot

does not display ny parameters I would imagine, this is my problem but I cant try

Can someone nudge me in the right direction?

thank

-bc

+3


source to share





All Articles