Skip to content

Commit

Permalink
Adding logging to make regional scenarios more clear (#6641)
Browse files Browse the repository at this point in the history
Was able to confirm the regional configuration api works. Logs make the
used endpoint misleading.
Fix for
#6510

---------

Co-authored-by: trwalke <[email protected]>
  • Loading branch information
trwalke and trwalke authored Nov 8, 2023
1 parent d375742 commit a274857
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Adding logging to make regional scenarios more clear",
"packageName": "@azure/msal-node",
"email": "[email protected]",
"dependentChangeType": "patch"
}
9 changes: 5 additions & 4 deletions lib/msal-node/src/client/ClientApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,17 +412,18 @@ export abstract class ClientApplication {
: this.config.auth.azureCloudOptions;

// using null assertion operator as we ensure that all config values have default values in buildConfiguration()
this.logger.verbose(
`building oauth client configuration with the authority: ${authority}`,
requestCorrelationId
);
const discoveredAuthority = await this.createAuthority(
authority,
azureRegionConfiguration,
requestCorrelationId,
userAzureCloudOptions
);

this.logger.info(
`Building oauth client configuration with the following authority: ${discoveredAuthority.tokenEndpoint}.`,
requestCorrelationId
);

serverTelemetryManager?.updateRegionDiscoveryMetadata(
discoveredAuthority.regionDiscoveryMetadata
);
Expand Down
5 changes: 5 additions & 0 deletions lib/msal-node/src/client/ClientCredentialClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export class ClientCredentialClient extends BaseClient {
authority.tokenEndpoint,
queryParametersString
);

const requestBody = this.createTokenRequestBody(request);
const headers: Record<string, string> =
this.createTokenRequestHeaders();
Expand All @@ -244,6 +245,10 @@ export class ClientCredentialClient extends BaseClient {
sshKid: request.sshKid,
};

this.logger.info(
"Sending token request to endpoint: " + authority.tokenEndpoint
);

reqTimestamp = TimeUtils.nowSeconds();
const response = await this.executePostToTokenEndpoint(
endpoint,
Expand Down

0 comments on commit a274857

Please sign in to comment.