Skip to content

Commit

Permalink
Fix broken redirects
Browse files Browse the repository at this point in the history
When the target contains route parameters and we use the `navigate` method of the Angular router the route parameters get encoded which will result in an invalid url. We should use `navigateByUrl` here instead.
  • Loading branch information
cwmrowe authored Apr 9, 2020
1 parent 95277d7 commit e01f899
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 01-Login/src/app/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class AuthService {
// Response will be an array of user and login status
authComplete$.subscribe(([user, loggedIn]) => {
// Redirect to target route after callback processing
this.router.navigate([targetRoute]);
this.router.navigateByUrl(targetRoute);
});
}
}
Expand Down

1 comment on commit e01f899

@kevinsschmidt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also be updated in the Auth0 Quickstart for Angular.

Please sign in to comment.