bkper-js 2.35.1 → 2.35.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -2446,6 +2446,10 @@ export declare interface Config {
2446
2446
  apiKeyProvider?: () => Promise<string>;
2447
2447
  /**
2448
2448
  * Issue a valid OAuth2 access token with **https://www.googleapis.com/auth/userinfo.email** scope authorized.
2449
+ *
2450
+ * If omitted or if it returns undefined, requests are sent without an Authorization header.
2451
+ * This supports environments where authentication is injected outside bkper-js, such as
2452
+ * Bkper Platform outbound for server-side app routes.
2449
2453
  */
2450
2454
  oauthTokenProvider?: () => Promise<string | undefined>;
2451
2455
  /**
@@ -37,7 +37,10 @@ export class HttpApiRequest extends HttpRequest {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
38
  this.addCustomHeaders();
39
39
  yield this.addAgentIdHeader();
40
- this.setHeader("Authorization", `Bearer ${yield this.getAccessToken()}`);
40
+ const accessToken = yield this.getAccessToken();
41
+ if (accessToken) {
42
+ this.setHeader("Authorization", `Bearer ${accessToken}`);
43
+ }
41
44
  yield this.addApiKeyHeader();
42
45
  try {
43
46
  let resp = yield _super.execute.call(this);
@@ -200,9 +203,6 @@ export class HttpApiRequest extends HttpRequest {
200
203
  if (effectiveConfig.oauthTokenProvider) {
201
204
  token = yield effectiveConfig.oauthTokenProvider();
202
205
  }
203
- else {
204
- console.warn(`Token provider NOT configured!`);
205
- }
206
206
  if (token) {
207
207
  token = token.replace("Bearer ", "");
208
208
  token = token.replace("bearer ", "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "2.35.1",
3
+ "version": "2.35.2",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",