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

Commit

Permalink
fix(isAuthenticated): always check access_token existence
Browse files Browse the repository at this point in the history
  • Loading branch information
doktordirk committed Oct 11, 2016
1 parent e083ecb commit 72fb377
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/authService.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class AuthService {
if (this.config.autoUpdateToken
&& this.authentication.getAccessToken()
&& this.authentication.getRefreshToken()) {
this.updateToken();
this.updateToken().catch(_ => _);

return;
}
Expand Down Expand Up @@ -276,7 +276,7 @@ export class AuthService {
&& this.authentication.getAccessToken()
&& this.authentication.getRefreshToken()
) {
this.updateToken();
this.updateToken().catch(_ => _);
authenticated = true;
}

Expand Down
6 changes: 1 addition & 5 deletions src/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ export class Authentication {
}

isAuthenticated(): boolean {
const isTokenExpired = this.isTokenExpired();

if (isTokenExpired === undefined) return !!this.accessToken;

return !isTokenExpired;
return !!this.accessToken && !this.isTokenExpired();
}

/* get and set from response */
Expand Down

0 comments on commit 72fb377

Please sign in to comment.