Skip to content

Commit

Permalink
Refactor oidc adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Oct 10, 2023
1 parent 0c7ad39 commit 7e3e97f
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions web/src/core/adapters/oidc/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,12 @@ export async function createOidc(params: {
url = result.newUrl;
}

const names = ["code", "state", "session_state"];

let dummyUrl = "https://dummy.com";

for (const name of names) {
for (const name of ["code", "state", "session_state"]) {
const result = retrieveParamFromUrl({ name, url });

if (!result.wasPresent) {
if (names.indexOf(name) === 0) {
break read_successful_login_query_params;
} else {
assert(false);
}
}
assert(result.wasPresent);

dummyUrl = addParamToUrl({
"url": dummyUrl,
Expand All @@ -111,9 +103,10 @@ export async function createOidc(params: {
url = result.newUrl;
}

await userManager.signinRedirectCallback(dummyUrl);

// NOTE: Remove the query params from the url
window.history.pushState(null, "", url);

await userManager.signinRedirectCallback(dummyUrl);
}

let currentAccessToken = (await userManager.getUser())?.access_token ?? "";
Expand Down

0 comments on commit 7e3e97f

Please sign in to comment.