1
votes

I have a login route that will redirect the user to an external Open ID Connect login page. Once there, if the user clicks the back button, they hit the same route that redirected them, thus being redirected again. Is there a way to cancel Aurelia's navigation or prevent the current route from being remembered in the history?

       config.mapRoute({
            name: "login",
            nav: false,

            // If I exclude the module id, I get the desired behavior but errors are thrown from Aurelia.
            moduleId: "components/login/login",

            route: "login",
            navigationStrategy: (instruction: NavigationInstruction) => {

                // This promise constructs the redirect url then sets the window.location.href.
                // Unfortunately, Aurelia seems to be finishing its business before the page is redirected because this login route is recorded in history.
                return this.userManager.signinRedirect();

            }
        });
1

1 Answers

0
votes

I know its been a while so you probably found an answer elsewhere, but you can try

router.navigate('new url', { replace: true });