Skip to content

Commit

Permalink
fix: Fix OIDC authentication error when redirecting from another tab
Browse files Browse the repository at this point in the history
Closes #650
  • Loading branch information
meltyshev committed Mar 26, 2024
1 parent 1a5a853 commit 9d95ed6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions client/src/sagas/login/services/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export function* authenticateUsingOidc() {
const oidcConfig = yield select(selectors.selectOidcConfig);

const state = nanoid();
window.sessionStorage.setItem('oidc-state', state);
window.localStorage.setItem('oidc-state', state);

const nonce = nanoid();
window.sessionStorage.setItem('oidc-nonce', nonce);
window.localStorage.setItem('oidc-nonce', nonce);

let redirectUrl = `${oidcConfig.authorizationUrl}`;
redirectUrl += `&state=${encodeURIComponent(state)}`;
Expand All @@ -49,11 +49,11 @@ export function* authenticateUsingOidcCallback() {
// https://github.com/plankanban/planka/issues/511#issuecomment-1771385639
const params = new URLSearchParams(window.location.hash.substring(1) || window.location.search);

const state = window.sessionStorage.getItem('oidc-state');
window.sessionStorage.removeItem('oidc-state');
const state = window.localStorage.getItem('oidc-state');
window.localStorage.removeItem('oidc-state');

const nonce = window.sessionStorage.getItem('oidc-nonce');
window.sessionStorage.removeItem('oidc-nonce');
const nonce = window.localStorage.getItem('oidc-nonce');
window.localStorage.removeItem('oidc-nonce');

yield put(replace(Paths.LOGIN));

Expand Down

0 comments on commit 9d95ed6

Please sign in to comment.