Skip to content

Commit c1bd147

Browse files
Merge pull request #141 from jeroenheijmans/2-storage-race-conditions
Limit scope of the sample to the simple solution
2 parents ba0a17a + fd8ea62 commit c1bd147

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/app/core/auth.service.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@ export class AuthService {
4848
}
4949
});
5050

51-
// This is tricky, as it might cause race conditions (where access_token is set in another
52-
// tab before everything is said and done there.
53-
// TODO: Improve this setup. See: https://github.com/jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards/issues/2
51+
// THe following cross-tab communication of fresh access tokens works usually in practice,
52+
// but if you need more robust handling the community has come up with ways to extend logic
53+
// in the library which may give you better mileage.
54+
//
55+
// See: https://github.com/jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards/issues/2
56+
//
57+
// Until then we'll stick to this:
5458
window.addEventListener('storage', (event) => {
5559
// The `key` is `null` if the event was caused by `.clear()`
5660
if (event.key !== 'access_token' && event.key !== null) {

0 commit comments

Comments
 (0)