@azure/msal-node 1.18.1 → 1.18.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.
@@ -1,4 +1,4 @@
1
- import { Constants as Constants$1, ProtocolMode, AzureCloudInstance, LogLevel, StringUtils, AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, ThrottlingEntity, TokenCacheContext, AuthError, Logger, ResponseMode, AuthenticationScheme, AuthorizationCodeClient, RefreshTokenClient, SilentFlowClient, UsernamePasswordClient, ClientAuthError, OIDC_DEFAULT_SCOPES, ServerTelemetryManager, Authority, AuthorityFactory, UrlString, DeviceCodeClient, ServerError, CodeChallengeMethodValues, TimeUtils, ClientCredentialClient, OnBehalfOfClient } from '@azure/msal-common';
1
+ import { Constants as Constants$1, ProtocolMode, AzureCloudInstance, LogLevel, StringUtils, AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, ThrottlingEntity, TokenCacheContext, AuthError, Logger, ResponseMode, AuthenticationScheme, AuthorizationCodeClient, RefreshTokenClient, SilentFlowClient, UsernamePasswordClient, ClientAuthError, OIDC_DEFAULT_SCOPES, ServerTelemetryManager, Authority, AuthorityFactory, UrlString, DeviceCodeClient, CodeChallengeMethodValues, ServerError, TimeUtils, ClientCredentialClient, OnBehalfOfClient } from '@azure/msal-common';
2
2
  export { AuthError, AuthErrorMessage, AzureCloudInstance, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, LogLevel, Logger, PromptValue, ProtocolMode, ResponseMode, ServerError, TokenCacheContext } from '@azure/msal-common';
3
3
  import http, { createServer } from 'http';
4
4
  import https from 'https';
@@ -1632,7 +1632,7 @@ class TokenCache {
1632
1632
 
1633
1633
  /* eslint-disable header/header */
1634
1634
  const name = "@azure/msal-node";
1635
- const version = "1.18.1";
1635
+ const version = "1.18.3";
1636
1636
 
1637
1637
  /*
1638
1638
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2222,35 +2222,40 @@ class PublicClientApplication extends ClientApplication {
2222
2222
  challenge
2223
2223
  } = await this.cryptoProvider.generatePkceCodes();
2224
2224
  const loopbackClient = customLoopbackClient || new LoopbackClient();
2225
- const authCodeListener = loopbackClient.listenForAuthCode(successTemplate, errorTemplate);
2226
- const redirectUri = loopbackClient.getRedirectUri();
2227
- const validRequest = {
2228
- ...remainingProperties,
2229
- correlationId: correlationId,
2230
- scopes: request.scopes || OIDC_DEFAULT_SCOPES,
2231
- redirectUri: redirectUri,
2232
- responseMode: ResponseMode.QUERY,
2233
- codeChallenge: challenge,
2234
- codeChallengeMethod: CodeChallengeMethodValues.S256
2235
- };
2236
- const authCodeUrl = await this.getAuthCodeUrl(validRequest);
2237
- await openBrowser(authCodeUrl);
2238
- const authCodeResponse = await authCodeListener.finally(() => {
2225
+ try {
2226
+ const authCodeListener = loopbackClient.listenForAuthCode(successTemplate, errorTemplate);
2227
+ const redirectUri = loopbackClient.getRedirectUri();
2228
+ const validRequest = {
2229
+ ...remainingProperties,
2230
+ correlationId: correlationId,
2231
+ scopes: request.scopes || OIDC_DEFAULT_SCOPES,
2232
+ redirectUri: redirectUri,
2233
+ responseMode: ResponseMode.QUERY,
2234
+ codeChallenge: challenge,
2235
+ codeChallengeMethod: CodeChallengeMethodValues.S256
2236
+ };
2237
+ const authCodeUrl = await this.getAuthCodeUrl(validRequest);
2238
+ await openBrowser(authCodeUrl);
2239
+ const authCodeResponse = await authCodeListener.finally(() => {
2240
+ loopbackClient.closeServer();
2241
+ });
2242
+ if (authCodeResponse.error) {
2243
+ throw new ServerError(authCodeResponse.error, authCodeResponse.error_description, authCodeResponse.suberror);
2244
+ } else if (!authCodeResponse.code) {
2245
+ throw NodeAuthError.createNoAuthCodeInResponseError();
2246
+ }
2247
+ const clientInfo = authCodeResponse.client_info;
2248
+ const tokenRequest = {
2249
+ code: authCodeResponse.code,
2250
+ codeVerifier: verifier,
2251
+ clientInfo: clientInfo || Constants$1.EMPTY_STRING,
2252
+ ...validRequest
2253
+ };
2254
+ return this.acquireTokenByCode(tokenRequest);
2255
+ } catch (e) {
2239
2256
  loopbackClient.closeServer();
2240
- });
2241
- if (authCodeResponse.error) {
2242
- throw new ServerError(authCodeResponse.error, authCodeResponse.error_description, authCodeResponse.suberror);
2243
- } else if (!authCodeResponse.code) {
2244
- throw NodeAuthError.createNoAuthCodeInResponseError();
2245
- }
2246
- const clientInfo = authCodeResponse.client_info;
2247
- const tokenRequest = {
2248
- code: authCodeResponse.code,
2249
- codeVerifier: verifier,
2250
- clientInfo: clientInfo || Constants$1.EMPTY_STRING,
2251
- ...validRequest
2252
- };
2253
- return this.acquireTokenByCode(tokenRequest);
2257
+ throw e;
2258
+ }
2254
2259
  }
2255
2260
  /**
2256
2261
  * Returns a token retrieved either from the cache or by exchanging the refresh token for a fresh access token. If brokering is enabled the token request will be serviced by the broker.