Skip to content
Permalink
Browse files

fix(authService): update internal authentication fields

This is critical for a scenario when two or more browser windows are open and one of them refreshes a token.
Previously `this.authentication.exp` was equal to the old token exp, which caused premature sign out event, 
which in its' turn signed out all the open windows.
  • Loading branch information
MaximBalaganskiy committed May 1, 2019
1 parent dcb9bce commit 86620c01231bc10ca878078185651c02e8215627
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/authService.js
@@ -88,8 +88,9 @@ export class AuthService {
// 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.updateAuthenticated();
// we need to set the whole response object again so that this.authentication.exp gets updated too
// this is critical for a scenario when two browser windows are open and one of them refreshes a token
this.setResponseObject(this.authentication.getResponseObject());

return;
}

0 comments on commit 86620c0

Please sign in to comment.
You can’t perform that action at this time.