@azure/identity 3.2.0-alpha.20230411.7 → 3.2.0-alpha.20230413.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.

Potentially problematic release.


This version of @azure/identity might be problematic. Click here for more details.

package/dist/index.js CHANGED
@@ -1217,7 +1217,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
1217
1217
  * Attempts to retrieve a token from cache.
1218
1218
  */
1219
1219
  async getTokenSilent(scopes, options) {
1220
- var _a, _b;
1220
+ var _a, _b, _c;
1221
1221
  await this.getActiveAccount();
1222
1222
  if (!this.account) {
1223
1223
  throw new AuthenticationRequiredError({
@@ -1236,7 +1236,14 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
1236
1236
  };
1237
1237
  try {
1238
1238
  this.logger.info("Attempting to acquire token silently");
1239
- const response = (_b = (await ((_a = this.confidentialApp) === null || _a === void 0 ? void 0 : _a.acquireTokenSilent(silentRequest)))) !== null && _b !== void 0 ? _b : (await this.publicApp.acquireTokenSilent(silentRequest));
1239
+ /**
1240
+ * The following code to retrieve all accounts is done as a workaround in an attempt to force the
1241
+ * refresh of the token cache with the token and the account passed in through the
1242
+ * `authenticationRecord` parameter. See issue - https://github.com/Azure/azure-sdk-for-js/issues/24349#issuecomment-1496715651
1243
+ * This workaround serves as a workoaround for silent authentication not happening when authenticationRecord is passed.
1244
+ */
1245
+ await ((_a = (this.publicApp || this.confidentialApp)) === null || _a === void 0 ? void 0 : _a.getTokenCache().getAllAccounts());
1246
+ const response = (_c = (await ((_b = this.confidentialApp) === null || _b === void 0 ? void 0 : _b.acquireTokenSilent(silentRequest)))) !== null && _c !== void 0 ? _c : (await this.publicApp.acquireTokenSilent(silentRequest));
1240
1247
  return this.handleResult(scopes, this.clientId, response || undefined);
1241
1248
  }
1242
1249
  catch (err) {