I am using msal node the latest version. This is my code:
protected getConfidentialClientApplication(tenantId: string): ConfidentialClientApplication {
if (this.confidentialClientApplication) {
return this.confidentialClientApplication;
}
this.confidentialClientApplication = new ConfidentialClientApplication({
auth: {
clientId: this.tokenConfiguration.clientId,
clientCertificate: {
thumbprint: this.tokenConfiguration.thumbprint,
privateKey: this.tokenConfiguration.privateKey,
x5c: this.tokenConfiguration.publicKey
},
authority: this.tokenConfiguration.authority + tenantId,
knownAuthorities: [this.tokenConfiguration.authority + tenantId]
},
});
return this.confidentialClientApplication;
}
protected getTokenRequest(correlationId: string): ClientCredentialRequest {
return {
scopes: this.getScopes(),
correlationId: correlationId,
azureRegion: "TryAutoDetect"
};
}
and I am calling this method:
this.getConfidentialClientApplication(tenantId).acquireTokenByClientCredential(tokenRequest)
If I am watching the response of the request, the token exist but the account is empty.
Also, msalTokenCache.getAllAccounts()
;
is always an empty list. How to resolve?