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

Commit

Permalink
fix(fetchClientConfig): reject when updateToken fails
Browse files Browse the repository at this point in the history
Let's say I've got current and refresh tokens in the storage. Current token is already expired and refresh one is not. But refresh one has been invalidated on a server.

In this scenario an original request will fail with 401 and http interceptor will try to update the token.
This update request will also fail because the refresh token has been invalidated. As a result, this uncaught rejection will break the execution flow completely.

There is no way to catch this rejection in the code which made the original call to an authorised endpoint.
  • Loading branch information
MaximBalaganskiy authored Jun 13, 2018
1 parent 9ae0e61 commit 9dd909b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/fetchClientConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ export class FetchConfig {
request.headers.set(this.config.authHeader, token);

return this.httpClient.fetch(request).then(resolve);
});
})
.catch(e => reject(e));
});
}
};
Expand Down

0 comments on commit 9dd909b

Please sign in to comment.