fix: race condition causing “update-credentials” to fire multiple times

This commit is contained in:
LuanRT
2022-07-28 05:11:10 -03:00
parent 9ef765dbc1
commit c16d632b31
4 changed files with 25 additions and 31 deletions

View File

@@ -92,8 +92,7 @@ export default class HTTPClient {
const oauth = this.#session.oauth;
if (oauth.validateCredentials()) {
// Check if the access token is valid to avoid authorization errors.
await oauth.checkAccessTokenValidity();
await oauth.refreshIfRequired();
request_headers.set('authorization', `Bearer ${oauth.credentials.access_token}`);