microsoft-authentication-library-for-js: acquireTokenByClientCredential broken for clientCertificate

Core Library

MSAL Node (@azure/msal-node)

Core Library Version

2.8.0

Wrapper Library

Not Applicable

Wrapper Library Version

n/a

Public or Confidential Client?

Confidential

Description

I upgraded to the latest version (2.8 from 2.7) and my call to acquireTokenByClientCredential fails now.

Error Message

{ “errorCode”: “invalid_client”, “errorMessage”: “7000216 - [2024-05-07 15:55:13Z]: AADSTS7000216: ‘client_assertion’, ‘client_secret’ or ‘request’ is required for the ‘client_credentials’ grant type. Trace ID: d1a0baab-1cf3-4a20-a263-605f65ceb200 Correlation ID: a93c308b-63ff-4880-8d07-383a27828034 Timestamp: 2024-05-07 15:55:13Z - Correlation ID: a93c308b-63ff-4880-8d07-383a27828034 - Trace ID: d1a0baab-1cf3-4a20-a263-605f65ceb200”, “subError”: “”, “name”: “ServerError”, “errorNo”: 7000216, “correlationId”: “2bedce44-4ef7-4752-abb9-39cfe913cea3” }

MSAL Logs

No response

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

const clientConfig: Configuration = {
      auth: {
                clientCertificate: {
                    thumbprint,
                    privateKey
                },
                clientId: ,
                authority
            }
        }

Relevant Code Snippets

const pca = new ConfidentialClientApplication(clientConfig);
        const clientCredentialRequest: ClientCredentialRequest = {
            scopes: ["https://graph.microsoft.com/.default"]
        };
        const newToken = pca
            .acquireTokenByClientCredential(clientCredentialRequest)

Reproduction Steps

Run the code above

Expected Behavior

A token is returned

Identity Provider

Entra ID (formerly Azure AD) / MSA

Browsers Affected (Select all that apply)

Chrome

Regression

@azure/msal-node @2.7.0

Source

External (Customer)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 19 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I have the same problem

I was able to reproduce the issue via tinkering with our unit tests and developed a fix via the linked PR. Unit tests are needed before review + merging into our dev branch. I’ll be publishing a new version of msal-node with this fix either today or tomorrow.

Fixed in v2.8.1, which is now available to install.

Hi, this started happening to me and my team as well for newer builds, as a workaround we had to downgrade to version 2.6.4