Skip to content

Commit

Permalink
fix: use build method to populate auth header
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-conde committed Nov 29, 2023
1 parent 7ffb9b8 commit 67a5566
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export class API extends mix(BaseAPI).with(
async build(method, url, options = {}) {
await super.build(method, url, options);

if (this.token) options.headers.Authorization = this._bearerAuth();

const transactionSrc = options.headers.transactionSrc || this.transactionSrc;
if (transactionSrc) options.headers.transactionSrc = transactionSrc;
}
Expand All @@ -72,8 +74,6 @@ export class API extends mix(BaseAPI).with(
// token from the auth API
this.token = null;
await this.getToken();

headers.Authorization = this._bearerHeader();
}

async getToken() {
Expand Down

0 comments on commit 67a5566

Please sign in to comment.