Skip to content

Commit

Permalink
fix / sso: after complete login via token make sure to delete only lo…
Browse files Browse the repository at this point in the history
…ginToken query-param from the window.location api.

Related to #16292

Signed-off-by: Bekliev Parviz <[email protected]>
  • Loading branch information
bekliev committed Feb 9, 2021
1 parent 2332cec commit 3e57378
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/vector/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@ function onTokenLoginCompleted() {
// if we did a token login, we're now left with the token, hs and is
// url as query params in the url; a little nasty but let's redirect to
// clear them.
const parsedUrl = url.parse(window.location.href);
parsedUrl.search = "";
const parsedUrl = url.parse(window.location.href, true);

parsedUrl.search = null; // to make `url.format` ignores `search` property and uses `query` instead
delete parsedUrl.query['loginToken'];

const formatted = url.format(parsedUrl);
console.log(`Redirecting to ${formatted} to drop loginToken from queryparams`);
window.history.replaceState(null, "", formatted);
Expand Down

0 comments on commit 3e57378

Please sign in to comment.