Skip to content

Commit afe4966

Browse files
Make repro for issue 218 visible
See: manfredsteyer/angular-oauth2-oidc#218 To reproduce: 1. Run `ng serve` for this commit 2. Open multiple (e.g. 4) Chrome windows with the demo app 3. Open the devtools Console on all of them 4. Keep the code open in VSCode 5. Log in on one window 6. Save any file to cause `ng` to reload all windows 7. Click "Clear Storage" button 8. Save any file to cause `ng` to reload all windows Rinse and repeat step 7/8 until the issue arises, clearly visible in the dev tools console.
1 parent 0ab656e commit afe4966

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/app/auth.service.ts

+6-10
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,12 @@ export class AuthService {
4747
});
4848

4949
window.addEventListener('storage', (event) => {
50-
// The `key` is `null` if the event was caused by `.clear()`
51-
if (event.key !== 'access_token' && event.key !== null) {
52-
return;
53-
}
54-
55-
console.warn('Noticed changes to access_token (most likely from another tab), updating isAuthenticated');
56-
this.isAuthenticatedSubject$.next(this.oauthService.hasValidAccessToken());
57-
58-
if (!this.oauthService.hasValidAccessToken()) {
59-
this.navigateToLoginPage();
50+
if (event.key === 'nonce') {
51+
console.log(
52+
'old nonce',
53+
(event.oldValue || '').substr(0, 15) + '...',
54+
'// new nonce',
55+
(event.newValue || '').substr(0, 15) + '...');
6056
}
6157
});
6258

0 commit comments

Comments
 (0)