Skip to content

Limit scope of the sample to the simple solution #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/app/core/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@ export class AuthService {
}
});

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