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

Commit

Permalink
fix(authentication): prevent logout if there is no identity
Browse files Browse the repository at this point in the history
BREAKING CHANGE: authentication failures on 401 now return the response in the rejection.
  • Loading branch information
RWOverdijk committed Jun 8, 2017
1 parent cd3c42b commit aea4ac8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/fetchClientConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export class FetchConfig {
if (response.status !== 401) {
return resolve(response);
}
// when we get a 401 and are not logged in, there's not much to do except reject the request
if (!this.authService.authenticated) {
return reject(response);
}
// logout when server invalidated the authorization token but the token itself is still valid
if (this.config.httpInterceptor && this.config.logoutOnInvalidtoken && !this.authService.isTokenExpired()) {
return reject(this.authService.logout());
Expand Down

0 comments on commit aea4ac8

Please sign in to comment.