Skip to content

Commit

Permalink
refactor: rename auth header builders
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-conde committed Nov 29, 2023
1 parent 67a5566 commit 7a3832f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/base.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { API as BaseAPI, mix, load, conf, verify } from "yonius";
import { API as BaseAPI, OperationalError, mix, load, conf } from "yonius";

import { LocatorAPI } from "./locator";
import { PaperlessAPI } from "./paperless";
Expand Down Expand Up @@ -83,7 +83,7 @@ export class API extends mix(BaseAPI).with(
const data = `grant_type=${this.grantType}`;
const options = {
headers: {
Authorization: this._basicHeader()
Authorization: this._basicAuth()
},
data: data,
mime: "application/x-www-form-urlencoded"
Expand Down Expand Up @@ -136,12 +136,12 @@ export class API extends mix(BaseAPI).with(
return result;
}

_basicHeader() {
_basicAuth() {
const auth = Buffer.from(`${this.clientId}:${this.clientSecret}`).toString("base64");
return `Basic ${auth}`;
}

_bearerHeader() {
_bearerAuth() {
return `Bearer ${this.token}`;
}
}

0 comments on commit 7a3832f

Please sign in to comment.