Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
fix(authService): detect logout events in different tabs when using a…
Browse files Browse the repository at this point in the history
…utoupdate of tokens.

fixes #379
  • Loading branch information
doktordirk committed Apr 27, 2018
1 parent 9fa7eff commit 75029b2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/authService.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ export class AuthService {
return;
}

// in case auto refresh tokens are enabled
if (this.config.autoUpdateToken && this.authentication.getAccessToken() && this.authentication.getRefreshToken()) {
// in case auto refresh tokens are enabled, tokens are allowed to differ
// logouts (event.newValue===null) and logins (authentication.getAccessToken()===null), need to be handled bellow though
if (event.newValue && this.config.autoUpdateToken && this.authentication.getAccessToken() && this.authentication.getRefreshToken()) {
// we just need to check the status of the updated token we have in storage
this.authentication.updateAuthenticated();
this.updateAuthenticated();

return;
}
Expand Down

0 comments on commit 75029b2

Please sign in to comment.