Permalink
Browse files

fix(authService): redirect on refresh token failure when configured t…

…o do so

PR fixes
  • Loading branch information...
Grzegorz
Grzegorz committed Jun 28, 2017
1 parent a001767 commit f23fd60e67a0f867cc5dfbf1bc4fcd3b756f4f67
Showing with 10 additions and 9 deletions.
  1. +10 −9 src/authService.js
@@ -391,19 +391,20 @@ export class AuthService {
: this.config.loginUrl), content, this.config.getOptionsForTokenRequests())
.then(response => {
this.setResponseObject(response);
if(this.getAccessToken()){
this.authentication.resolveUpdateTokenCallstack(this.isAuthenticated());
}else{
this.setResponseObject(null);
if (this.config.expiredRedirect) {
PLATFORM.location.assign(this.config.expiredRedirect);
}
this.authentication.resolveUpdateTokenCallstack(Promise.reject(new Error('accessToken not found in refreshToken response')));
}
if (this.getAccessToken()) {
this.authentication.resolveUpdateTokenCallstack(this.isAuthenticated());
} else {
this.setResponseObject(null);
if (this.config.expiredRedirect) {
PLATFORM.location.assign(this.config.expiredRedirect);
}
this.authentication.resolveUpdateTokenCallstack(Promise.reject(new Error('accessToken not found in refreshToken response')));
}
})
.catch(error => {
this.setResponseObject(null);
if (this.config.expiredRedirect) {
PLATFORM.location.assign(this.config.expiredRedirect);
}

0 comments on commit f23fd60

Please sign in to comment.