@azure/identity 3.2.0-alpha.20230418.1 → 3.2.0-alpha.20230420.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
|
@@ -2893,14 +2893,18 @@ class ChainedTokenCredential {
|
|
|
2893
2893
|
* `TokenCredential` implementation might make.
|
|
2894
2894
|
*/
|
|
2895
2895
|
async getToken(scopes, options = {}) {
|
|
2896
|
+
const { token } = await this.getTokenInternal(scopes, options);
|
|
2897
|
+
return token;
|
|
2898
|
+
}
|
|
2899
|
+
async getTokenInternal(scopes, options = {}) {
|
|
2896
2900
|
let token = null;
|
|
2897
|
-
let
|
|
2901
|
+
let successfulCredential;
|
|
2898
2902
|
const errors = [];
|
|
2899
2903
|
return tracingClient.withSpan("ChainedTokenCredential.getToken", options, async (updatedOptions) => {
|
|
2900
2904
|
for (let i = 0; i < this._sources.length && token === null; i++) {
|
|
2901
2905
|
try {
|
|
2902
2906
|
token = await this._sources[i].getToken(scopes, updatedOptions);
|
|
2903
|
-
|
|
2907
|
+
successfulCredential = this._sources[i];
|
|
2904
2908
|
}
|
|
2905
2909
|
catch (err) {
|
|
2906
2910
|
if (err.name === "CredentialUnavailableError" ||
|
|
@@ -2918,11 +2922,11 @@ class ChainedTokenCredential {
|
|
|
2918
2922
|
logger$9.getToken.info(formatError(scopes, err));
|
|
2919
2923
|
throw err;
|
|
2920
2924
|
}
|
|
2921
|
-
logger$9.getToken.info(`Result for ${
|
|
2925
|
+
logger$9.getToken.info(`Result for ${successfulCredential.constructor.name}: ${formatSuccess(scopes)}`);
|
|
2922
2926
|
if (token === null) {
|
|
2923
2927
|
throw new CredentialUnavailableError("Failed to retrieve a valid token");
|
|
2924
2928
|
}
|
|
2925
|
-
return token;
|
|
2929
|
+
return { token, successfulCredential };
|
|
2926
2930
|
});
|
|
2927
2931
|
}
|
|
2928
2932
|
}
|