mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
fix: Fix OIDC authentication error when redirecting from another tab
Closes #650
This commit is contained in:
parent
5484dd09a5
commit
6c472dc252
1 changed files with 6 additions and 6 deletions
|
@ -33,10 +33,10 @@ export function* authenticateUsingOidc() {
|
||||||
const oidcConfig = yield select(selectors.selectOidcConfig);
|
const oidcConfig = yield select(selectors.selectOidcConfig);
|
||||||
|
|
||||||
const state = nanoid();
|
const state = nanoid();
|
||||||
window.sessionStorage.setItem('oidc-state', state);
|
window.localStorage.setItem('oidc-state', state);
|
||||||
|
|
||||||
const nonce = nanoid();
|
const nonce = nanoid();
|
||||||
window.sessionStorage.setItem('oidc-nonce', nonce);
|
window.localStorage.setItem('oidc-nonce', nonce);
|
||||||
|
|
||||||
let redirectUrl = `${oidcConfig.authorizationUrl}`;
|
let redirectUrl = `${oidcConfig.authorizationUrl}`;
|
||||||
redirectUrl += `&state=${encodeURIComponent(state)}`;
|
redirectUrl += `&state=${encodeURIComponent(state)}`;
|
||||||
|
@ -49,11 +49,11 @@ export function* authenticateUsingOidcCallback() {
|
||||||
// https://github.com/plankanban/planka/issues/511#issuecomment-1771385639
|
// https://github.com/plankanban/planka/issues/511#issuecomment-1771385639
|
||||||
const params = new URLSearchParams(window.location.hash.substring(1) || window.location.search);
|
const params = new URLSearchParams(window.location.hash.substring(1) || window.location.search);
|
||||||
|
|
||||||
const state = window.sessionStorage.getItem('oidc-state');
|
const state = window.localStorage.getItem('oidc-state');
|
||||||
window.sessionStorage.removeItem('oidc-state');
|
window.localStorage.removeItem('oidc-state');
|
||||||
|
|
||||||
const nonce = window.sessionStorage.getItem('oidc-nonce');
|
const nonce = window.localStorage.getItem('oidc-nonce');
|
||||||
window.sessionStorage.removeItem('oidc-nonce');
|
window.localStorage.removeItem('oidc-nonce');
|
||||||
|
|
||||||
yield put(replace(Paths.LOGIN));
|
yield put(replace(Paths.LOGIN));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue