@@ -457,9 +457,9 @@ export abstract class ClientApplication {
457
457
serverTelemetryManager : serverTelemetryManager ,
458
458
clientCredentials : {
459
459
clientSecret : this . clientSecret ,
460
- clientAssertion : this . developerProvidedClientAssertion
461
- ? await this . getClientAssertion ( discoveredAuthority )
462
- : undefined ,
460
+ clientAssertion : await this . getClientAssertion (
461
+ discoveredAuthority
462
+ ) ,
463
463
} ,
464
464
libraryInfo : {
465
465
sku : NodeConstants . MSAL_SKU ,
@@ -478,22 +478,26 @@ export abstract class ClientApplication {
478
478
private async getClientAssertion (
479
479
authority : Authority
480
480
) : Promise < ClientAssertionType > {
481
- this . clientAssertion = ClientAssertion . fromAssertion (
482
- await getClientAssertion (
483
- this . developerProvidedClientAssertion ,
484
- this . config . auth . clientId ,
485
- authority . tokenEndpoint
486
- )
487
- ) ;
481
+ if ( this . developerProvidedClientAssertion ) {
482
+ this . clientAssertion = ClientAssertion . fromAssertion (
483
+ await getClientAssertion (
484
+ this . developerProvidedClientAssertion ,
485
+ this . config . auth . clientId ,
486
+ authority . tokenEndpoint
487
+ )
488
+ ) ;
489
+ }
488
490
489
- return {
490
- assertion : this . clientAssertion . getJwt (
491
- this . cryptoProvider ,
492
- this . config . auth . clientId ,
493
- authority . tokenEndpoint
494
- ) ,
495
- assertionType : NodeConstants . JWT_BEARER_ASSERTION_TYPE ,
496
- } ;
491
+ return (
492
+ this . clientAssertion && {
493
+ assertion : this . clientAssertion . getJwt (
494
+ this . cryptoProvider ,
495
+ this . config . auth . clientId ,
496
+ authority . tokenEndpoint
497
+ ) ,
498
+ assertionType : NodeConstants . JWT_BEARER_ASSERTION_TYPE ,
499
+ }
500
+ ) ;
497
501
}
498
502
499
503
/**
0 commit comments