"Cannot match any routes" Error

I’m using the Authentication API in an Angular application, and I’m seeing some unexpected behvaior despite the login doing ALMOST what it’s supposed to:

!) After successful login, the router navigates to the page iit’s supposed to, but there are query parameters in the URL that I don’t understand why they’re there, and the console throws an “ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL” The URL looks like: http://localhost:3000/survey-intro?code=xP_08WfGby5pLhud&state=VGNMWE0yS3dtdmRjZ0VzbzV%2BdUZ3Y0FSQXpFenJUalBEaX5PdmhnZVNEYQ%3D%3D

Any insight here would be appreciated!

Hi @michaelscaveney,

The state param is used to pick up on the session where the user left off before authentication.

Can you post the code you are using in your routing module?

Sure thing, names have changed since I initially posted this, so the relevant component is UserHome. I didn’t include imports, but they’re all there in the file:

    const routes: Routes = [
  {
    path: '',
    component: LandingComponent,
    pathMatch: 'full'
  },
  {
    path: 'network-build',
    component: NetworkBuildComponent,
    canActivate: [AuthGuard]
  },
  {
    path: 'profile',
    component: ProfileComponent,
    canActivate: [AuthGuard]
  },
  {
    path: 'user-home',
    component: UserHomeComponent,
    canActivate: [AuthGuard]
  },
  {
    path: 'survey-start',
    component: SurveyStartComponent,
    canActivate: [AuthGuard]
  }
];
@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

And you changed the URL to user-home?

Correct, in both the auth service and the Auth0 dashboard

Can you send me a HAR file in a direct message?

The HAR looks good. This is something to do with angular. Are your other routes working correctly?

Yes, everything else is behaving as I expect

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.