diff --git a/samples/VanillaJS/public/code-identityserver-sample.js b/samples/VanillaJS/public/code-identityserver-sample.js index 796fae09..6c1d901c 100644 --- a/samples/VanillaJS/public/code-identityserver-sample.js +++ b/samples/VanillaJS/public/code-identityserver-sample.js @@ -123,7 +123,7 @@ function removeUser() { function startSigninMainWindow() { var someState = {message:'some data'}; - mgr.signinRedirect({state:someState}).then(function() { + mgr.signinRedirect({state:someState, useReplaceToNavigate:true}).then(function() { log("signinRedirect done"); }).catch(function(err) { log(err); diff --git a/src/RedirectNavigator.js b/src/RedirectNavigator.js index ab7a9361..fa382443 100644 --- a/src/RedirectNavigator.js +++ b/src/RedirectNavigator.js @@ -15,7 +15,12 @@ export class RedirectNavigator { return Promise.reject(new Error("No url provided")); } - window.location = params.url; + if (params.useReplaceToNavigate) { + window.location.replace(params.url); + } + else { + window.location = params.url; + } return Promise.resolve(); } diff --git a/src/UserManager.js b/src/UserManager.js index 7807b08b..3f471288 100644 --- a/src/UserManager.js +++ b/src/UserManager.js @@ -88,7 +88,10 @@ export class UserManager extends OidcClient { signinRedirect(args = {}) { args.request_type = "si:r"; - return this._signinStart(args, this._redirectNavigator).then(()=>{ + let navParams = { + useReplaceToNavigate : args.useReplaceToNavigate + }; + return this._signinStart(args, this._redirectNavigator, navParams).then(()=>{ Log.info("UserManager.signinRedirect: successful"); }); }