@adobe/helix-onedrive-support 11.0.2 → 11.0.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [11.0.3](https://github.com/adobe/helix-onedrive-support/compare/v11.0.2...v11.0.3) (2023-10-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * report authenticate failures as 401 ([#454](https://github.com/adobe/helix-onedrive-support/issues/454)) ([26caba0](https://github.com/adobe/helix-onedrive-support/commit/26caba08586beecb08bf88ed5e0afe9032fbb9ae))
7
+
1
8
  ## [11.0.2](https://github.com/adobe/helix-onedrive-support/compare/v11.0.1...v11.0.2) (2023-10-20)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-onedrive-support",
3
- "version": "11.0.2",
3
+ "version": "11.0.3",
4
4
  "description": "Helix OneDrive Support",
5
5
  "main": "src/index.js",
6
6
  "exports": {
package/src/OneDrive.js CHANGED
@@ -218,7 +218,7 @@ export class OneDrive {
218
218
  try {
219
219
  return await this.doFetch(`/shares/${link}/driveItem`);
220
220
  } catch (e) {
221
- if (e.statusCode === 401 || e.statusCode === 403) {
221
+ if ((e.statusCode === 401 && e.details?.code !== 'silentAcquireFailed') || e.statusCode === 403) {
222
222
  // an inexistent share returns either 401 or 403, we prefer to just say it wasn't found
223
223
  throw new StatusCodeError(e.message, 404, e.details);
224
224
  }
@@ -535,7 +535,7 @@ export class OneDrive {
535
535
  log: this.log,
536
536
  });
537
537
  } catch (e) {
538
- if (e.statusCode === 401) {
538
+ if (e.statusCode === 401 && e.details?.code !== 'silentAcquireFailed') {
539
539
  // an inexistant share returns 401, we prefer to just say it wasn't found
540
540
  throw new StatusCodeError(e.message, 404, e.details);
541
541
  }
@@ -15,6 +15,7 @@ import { keepAliveNoCache } from '@adobe/fetch';
15
15
  import { ConfidentialClientApplication, LogLevel, PublicClientApplication } from '@azure/msal-node';
16
16
  import { MemCachePlugin } from '@adobe/helix-shared-tokencache';
17
17
  import { decodeJwt } from 'jose';
18
+ import { StatusCodeError } from './StatusCodeError.js';
18
19
 
19
20
  const AZ_AUTHORITY_HOST_URL = 'https://login.windows.net';
20
21
  const AZ_COMMON_TENANT = 'common';
@@ -343,7 +344,8 @@ export class OneDriveAuth {
343
344
  throw e;
344
345
  }
345
346
 
346
- throw new Error('Unable to acquire token silently and no other acquire method supplied');
347
+ const message = 'Unable to acquire token silently and no other acquire method supplied';
348
+ throw new StatusCodeError(message, 401, { code: 'silentAcquireFailed', message });
347
349
  }
348
350
 
349
351
  /**