Skip to content

Commit

Permalink
Merge pull request #571 from kbss-cvut/fix/570-fix-login-to-kc-in-dev…
Browse files Browse the repository at this point in the history
…-mode

Fix kc login when in dev mode in IDE
  • Loading branch information
blcham authored Aug 24, 2024
2 parents 79cb609 + 6fc6b1d commit 2e4fe28
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/misc/oidc/OidcSignInCallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@ import { getUserManager } from "@utils/OidcUtils";

const OidcSignInCallback = () => {
useEffect(() => {
const key = "cb-in-progress";
if (sessionStorage.getItem(key)) return;
sessionStorage.setItem(key, "in progress");
getUserManager()
.signinRedirectCallback()
.then(() => {
sessionStorage.removeItem(key);
const searchParams = new URLSearchParams(location.search);
if (!searchParams.has("forward_uri")) {
throw Error("Missing parameter forward_uri");
}
const forwardUri = window.atob(searchParams.get("forward_uri"));
window.location.replace(forwardUri);
})
.catch(() => {
sessionStorage.removeItem(key);
});
}, []);

Expand Down

0 comments on commit 2e4fe28

Please sign in to comment.