question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot match any routes. URL Segment: '%2F' after login

See original GitHub issue

Hi all,

after logging in, my application throws this error:

core.js:4061 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: '%2F'
Error: Cannot match any routes. URL Segment: '%2F'
    at ApplyRedirects.push../node_modules/@angular/router/fesm5/router.js.ApplyRedirects.noMatchError (router.js:2471)
    at CatchSubscriber.selector (router.js:2452)
    at CatchSubscriber.push../node_modules/rxjs/_esm5/internal/operators/catchError.js.CatchSubscriber.error (catchError.js:34)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:79)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (Subscriber.js:59)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:79)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (Subscriber.js:59)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:79)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (Subscriber.js:59)
    at ThrowIfEmptySubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (Subscriber.js:79)
    at resolvePromise (zone.js:832)
    at resolvePromise (zone.js:784)
    at zone.js:894
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:27791)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:601)
    at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:507)
    at ZoneTask.invoke (zone.js:492)

I already set initialNavigation to false and tried the steps proposed here:

https://manfredsteyer.github.io/angular-oauth2-oidc/docs/additional-documentation/routing-with-the-hashstrategy.html

My auth config (if this matters) looks like this, by usage of implicit flow:

authConfig: {
		issuer: 'https://localhost:5001',
		redirectUri: 'http://localhost:4200/',
		postLogoutRedirectUri: 'http://localhost:4200/',
		clientId: 'api-client',
		responseType: 'id_token token',
		silentRefreshRedirectUri: 'http://localhost:4200/silent-refresh.html',
		showDebugInformation: false,
		scope: 'openid api',
		silentRefreshTimeout: 25000,
		timeoutFactor: 0.75,
		sessionChecksEnabled: true,
		clearHashAfterLogin: false
	},

My application routes are like that:

const routes: Routes = [
  // { path: 'home', component: BoxesPanelComponent, canActivate: [LoginAuthGuard] },
  { path: 'login', component: LoginComponent },
  { path: '', component: BoxesPanelComponent, canActivate: [LoginAuthGuard] },
];

Do you have any hints, how I can fix that exception?

Thanks in advance,

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
manfredsteyercommented, Mar 27, 2020

Hi,

I have currently a hard time, reproducing this. Can you please let me know what to do to make this issue in our sample application happen?

0reactions
jeroenheijmanscommented, Mar 28, 2020

@manfredsteyer Could be good to merge my PR if there’s no bandwidth to do the other option. Then the action needed from users gets some more visibility.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Cannot match any routes. URL Segment: - Angular 2
Solved myself. Done some small structural changes also. Route from Component1 to Component2 is done by a single <router-outlet> .
Read more >
Error: Cannot match any routes - Nishu Goel - Medium
This generally occurs when there is a mismatch in the routes specified, or a component which is not present in our routing configuration,...
Read more >
Error: Cannot match any routes. URL Segment: 'tabs/groups'
I am trying to put all my tabs under auth guard and users can see those tabs after they logged in, but I...
Read more >
"Cannot match any routes" Error - Auth0 Community
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 ......
Read more >
Router tutorial: tour of heroes - Angular
A wildcard route has a path consisting of two asterisks. It matches every URL. Thus, the router selects this wildcard route if it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found