attempt to getTokens after call to logout results in exception
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- authentication
Direzione di ricerca
Reproduce the Chrome and Firefox failures using the listed logout-then-login steps, then start in appAuthHelper.js around lines 259-281 and appAuthHelperFetchTokensBundle.js around line 46. Trace the service-worker token request after logout and verify that calling getTokens after logout no longer produces an unhandled DOMException or DataCloneError.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
In Chrome, the following exception is unhandled when getTokens is called after logout:
Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'ServiceWorker': Port at index 0 is already neutered.
at Object.<anonymous> (https://localhost:3000/static/js/vendors~main.chunk.js:67061:28)
(anonymous) @ appAuthHelper.js:272
Promise.then (async)
(anonymous) @ appAuthHelper.js:266
Promise.then (async)
(anonymous) @ appAuthHelper.js:264
(anonymous) @ appAuthHelper.js:281
registerIdentityProxy @ appAuthHelper.js:259
(anonymous) @ appAuthHelper.js:114
postMessage (async)
(anonymous) @ appAuthHelperFetchTokensBundle.js:46
Promise.then (async)
(anonymous) @ appAuthHelperFetchTokensBundle.js:46
2../TokenManager @ appAuthHelperFetchTokensBundle.js:46
t @ appAuthHelperFetchTokensBundle.js:46
(anonymous) @ appAuthHelperFetchTokensBundle.js:46
3../appAuthHelperFetchTokens @ appAuthHelperFetchTokensBundle.js:46
t @ appAuthHelperFetchTokensBundle.js:46
s @ appAuthHelperFetchTokensBundle.js:46
(anonymous) @ appAuthHelperFetchTokensBundle.js:46
However, with Firefox one gets React error boundary catching the error, resulting in the more cryptic, maybe it tried to serialize
Unhandled Rejection (DataCloneError): The object could not be cloned.
I used the following component in React in order to test the workflow.
import React, { useEffect, useState } from 'react';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import AppAuthHelper from 'appauthhelper';
import { Toolbar } from '@mui/material';
// Make the authorization request
export const AuthTest = () => {
const [data, setData] = useState<any>(null);
useEffect(() => {
AppAuthHelper.init({
clientId: 'warden.mobile',
scopes: 'openid profile',
'authorizationEndpoint': 'https://localhost:44320/provider/auth',
'tokenEndpoint': 'https://localhost:44320/provider/token',
'revocationEndpoint': 'https://localhost:44320/provider/token/revocation',
tokensAvailableHandler: function (claims: any, id_token: any, interactively_logged_in: any) {
const data = { claims, id_token, interactively_logged_in };
// eslint-disable-next-line no-console
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>', data);
setData(data);
},
renewCooldownPeriod: 1,
oidc: true,
identityProxyPreference: 'serviceWorker', // Can be either "XHR" or "serviceWorker"
renewStrategy: 'authCode', // Can be either "authCode" or "refreshToken"
redirectUri: 'appAuthHelperRedirect.html', // Can be a relative or absolute url
serviceWorkerUri: 'appAuthServiceWorker.js' // Can be a relative or absolute url
}).then(() => {
AppAuthHelper.getTokens();
});
}, []);
return (
<div>
<button onClick={() => {
AppAuthHelper.getTokens();
}}>Login</button>
{ JSON.stringify(data, null, 2)}
<button onClick={() => {
setData(null);
AppAuthHelper.logout();
}}>Logout</button>
</div>
);
};
In order to reproduce this error, these steps are taken:
- Click "Logout" after token string appears
- Click "Login" after logout request completes
- Lingua principale
- JavaScript
- Stelle
- 52
- Fork
- 16
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ForgeRock/appAuthHelper
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
ForgeRock/appAuthHelper#68 · 2 reazioni ·
-
Cannot read properties of undefined (reading 'clientId'): appAuthHelperFetchTokensBundle.js:46:635Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
ForgeRock/appAuthHelper#67 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
ForgeRock/appAuthHelper#64 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
ForgeRock/appAuthHelper#62 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
ForgeRock/appAuthHelper#60 ·
Tutte le issue di ForgeRock/appAuthHelper
Issue simili
-
[dsh-plugin.org | dsh-plugin-hub] plugin distribution incomplete: yjh051108/dsh-routing-suiteAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 71/100
yjh051108/dsh-routing-suite#227 ·
-
needs-triage release-watch
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
dusk-network/exu#17 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
jspreadsheet/ce#1809 ·
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
githubnext/gh-aw-workshop#4458 ·
I maintainer di solito rispondono entro 1 giorno