@adobe/helix-onedrive-support 10.0.0 → 10.0.1
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 +7 -0
- package/package.json +2 -2
- package/src/OneDriveAuth.js +15 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [10.0.1](https://github.com/adobe/helix-onedrive-support/compare/v10.0.0...v10.0.1) (2023-05-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* provide username and location in error message ([#374](https://github.com/adobe/helix-onedrive-support/issues/374)) ([a50819d](https://github.com/adobe/helix-onedrive-support/commit/a50819d2520391ee43cc6954123680cfe1b47a21))
|
|
7
|
+
|
|
1
8
|
# [10.0.0](https://github.com/adobe/helix-onedrive-support/compare/v9.1.32...v10.0.0) (2023-05-02)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-onedrive-support",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"description": "Helix OneDrive Support",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"homepage": "https://github.com/adobe/helix-onedrive-support#readme",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@adobe/fetch": "4.0.10",
|
|
31
|
-
"@adobe/helix-shared-tokencache": "1.
|
|
31
|
+
"@adobe/helix-shared-tokencache": "1.1.0",
|
|
32
32
|
"@aws-sdk/client-s3": "3.321.1",
|
|
33
33
|
"@azure/msal-node": "1.17.1",
|
|
34
34
|
"jose": "4.14.3"
|
package/src/OneDriveAuth.js
CHANGED
|
@@ -265,6 +265,13 @@ export class OneDriveAuth {
|
|
|
265
265
|
return this;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
+
handleAcquireError(account, e, forced = false) {
|
|
269
|
+
const { log } = this;
|
|
270
|
+
const msg = `Error while reacquiring token from cache${forced ? ' (forced)' : ''}.`;
|
|
271
|
+
|
|
272
|
+
log.warn(`${msg}\nUsername: ${account.username}\nAuth-Location: ${this.cachePlugin.location}\nMessage: ${e.message}`);
|
|
273
|
+
}
|
|
274
|
+
|
|
268
275
|
/**
|
|
269
276
|
* Authenticates against MS
|
|
270
277
|
* @param {boolean} silentOnly
|
|
@@ -275,23 +282,24 @@ export class OneDriveAuth {
|
|
|
275
282
|
|
|
276
283
|
const accounts = await app.getTokenCache().getAllAccounts();
|
|
277
284
|
if (accounts.length > 0) {
|
|
285
|
+
const account = accounts[0];
|
|
286
|
+
|
|
278
287
|
try {
|
|
279
|
-
return await app.acquireTokenSilent({
|
|
280
|
-
account: accounts[0],
|
|
281
|
-
});
|
|
288
|
+
return await app.acquireTokenSilent({ account });
|
|
282
289
|
} catch (e) {
|
|
283
|
-
|
|
290
|
+
this.handleAcquireError(account, e);
|
|
284
291
|
}
|
|
292
|
+
|
|
285
293
|
// try again with fresh mem cache
|
|
286
294
|
if (this.cachePlugin instanceof MemCachePlugin) {
|
|
287
295
|
this.cachePlugin.clear();
|
|
288
296
|
try {
|
|
289
297
|
return await app.acquireTokenSilent({
|
|
290
298
|
forceRefresh: true,
|
|
291
|
-
account
|
|
299
|
+
account,
|
|
292
300
|
});
|
|
293
301
|
} catch (e) {
|
|
294
|
-
|
|
302
|
+
this.handleAcquireError(account, e, true);
|
|
295
303
|
}
|
|
296
304
|
}
|
|
297
305
|
}
|
|
@@ -316,7 +324,7 @@ export class OneDriveAuth {
|
|
|
316
324
|
});
|
|
317
325
|
}
|
|
318
326
|
} catch (e) {
|
|
319
|
-
log.error(
|
|
327
|
+
log.error(`Error while acquiring access token (${this.acquireMethod}).\nMessage: ${e.message}`);
|
|
320
328
|
throw e;
|
|
321
329
|
}
|
|
322
330
|
|