Skip to content

Commit

Permalink
Automatically force the user to log in again when the OIDC session ha…
Browse files Browse the repository at this point in the history
…s terminated or the token refresh has errors (ie token invalid). Closes #14.
  • Loading branch information
stuartcaunt committed Dec 4, 2024
1 parent 5247ecc commit 02f86ed
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app/core/services/authentication.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ export class AuthenticationService {
this._updateCookie();
}
});

this._oauthService.events
.pipe(filter(event => ['token_refresh_error', 'session_terminated'].includes(event.type)))
.subscribe(_ => {
// Access token is no longer valid and user must log in again
this.logout();
});
}

private _updateCookie(): void {
Expand Down

0 comments on commit 02f86ed

Please sign in to comment.