From 75029b23965362f9d35701fc3b38ac102fa88ea1 Mon Sep 17 00:00:00 2001 From: doktordirk Date: Fri, 27 Apr 2018 16:40:07 +0200 Subject: [PATCH] fix(authService): detect logout events in different tabs when using autoupdate of tokens. fixes #379 --- src/authService.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/authService.js b/src/authService.js index 3d4ee60..c5687b4 100644 --- a/src/authService.js +++ b/src/authService.js @@ -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; }