Skip to content

Commit

Permalink
feat: Rename clean-hash-fragment.js to pre-clean-url.js and extend it…
Browse files Browse the repository at this point in the history
… with code flow logic.
  • Loading branch information
RaymondSanders committed Mar 7, 2023
1 parent 9b31935 commit 758881c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
},
"scripts": {
"prepublishOnly": "npm run build",
"copyCleanHashFragment": "cp ./clean-hash-fragment.js dist/clean-hash-fragment.js",
"build": "npm run bundle && npm run copyCleanHashFragment && npm run typedoc",
"copyPreCleanUrl": "cp pre-clean-url.js dist/pre-clean-url.js",
"build": "npm run bundle && npm run copyPreCleanUrl && npm run typedoc",
"bundle": "rm -rf dist && microbundle --name OAuthClientCore --external none",
"dev": "microbundle watch --name OAuthClientCore --external none",
"dev:2": "microbundle watch --name OAuthClientCore --external none -o /Users/meesvandongen/conformance-suite/src/main/resources/static/oidc-test-client/dist",
Expand Down
14 changes: 14 additions & 0 deletions clean-hash-fragment.js → pre-clean-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,19 @@
document.title,
window.location.pathname + window.location.search
);
} else if (window.location.search.indexOf("code") !== -1) {
const url = new URL(window.location.href);

// Save the codeFlow url to sessionStorage
sessionStorage.setItem("codeFlowUrl", window.location.href);

url.searchParams.delete('code');
url.searchParams.delete('state');

history.pushState(
"",
document.title,
url.href
);
}
})(window);

0 comments on commit 758881c

Please sign in to comment.