question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

multiple_matching_tokens The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.

See original GitHub issue

Core Library

MSAL Node (@azure/msal-node)

Core Library Version

1.12.0

Wrapper Library

Not Applicable

Wrapper Library Version

None

Public or Confidential Client?

Confidential

Description

After adding 2 new MSAL flows for acquireTokenByRefreshToken and acquireTokenOnBehalfOf we started seeing some errors in existing workflows that had no issues (acquireTokenByClientCredential). The error we are receiving from MSAL is “multiple_matching_tokens”. We only see this issue in acquireTokenByClientCredential for our singleton client.

We added authority to all of our client codes as suggested by the error message below but we are still receiving these errors.

We noticed 2 similar incidents that were supposed to fix this issue: #4486 #4691

Error Message

“stack”: “ClientAuthError: multiple_matching_tokens: The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account…\n at ClientAuthError.AuthError [as constructor] (/app/node_modules/@azure/msal-node/node_modules/@azure/msal-common/dist/index.cjs.js:496:24)\n at new ClientAuthError (/app/node_modules/@azure/msal-node/node_modules/@azure/msal-common/dist/index.cjs.js:790:28)\n at Function.ClientAuthError.createMultipleMatchingTokensInCacheError (/app/node_modules/@azure/msal-node/node_modules/@azure/msal-common/dist/index.cjs.js:885:16)\n at ClientCredentialClient.readAccessTokenFromCache (/app/node_modules/@azure/msal-node/node_modules/@azure/msal-common/dist/index.cjs.js:6036:35)\n at ClientCredentialClient.<anonymous> (/app/node_modules/@azure/msal-node/node_modules/@azure/msal-common/dist/index.cjs.js:5996:50)\n at step (/app/node_modules/@azure/msal-node/node_modules/@azure/msal-common/dist/index.cjs.js:79:23)\n at Object.next (/app/node_modules/@azure/msal-node/node_modules/@azure/msal-common/dist/index.cjs.js:60:53)\n at /app/node_modules/@azure/msal-node/node_modules/@azure/msal-common/dist/index.cjs.js:53:71\n at new Promise (<anonymous>)\n at __awaiter (/app/node_modules/@azure/msal-node/node_modules/@azure/msal-common/dist/index.cjs.js:49:12)”, “message”: “multiple_matching_tokens: The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account…”, “errorCode”: “multiple_matching_tokens”, “errorMessage”: “The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account…”, “subError”: “”, “name”: “ClientAuthError” }

Msal Logs

No response

MSAL Configuration

auth: {
                clientId: "9edfcdd9-0bc5-4bd4-b287-c3afc716aac7"
                authority: "https://login.microsoftonline.com/organizations",
                clientCertificate: {
                    thumbprint: pem.thumbprint,
                    privateKey: pem.privateKey,
                    x5c: pem.certificate,
                },
            },

Relevant Code Snippets

this._client.acquireTokenByClientCredential({
  "scopes": [
    "https://management.azure.com/.default"
  ],
  "authority": "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47"
}),

Reproduction Steps

N/A

Expected Behavior

Expectation would be for acquireTokenBYClientCredential to return a valid access token matching the passed in requirements.

Identity Provider

Azure AD / MSA

Browsers Affected (Select all that apply)

None (Server)

Regression

No response

Source

Internal (Microsoft)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:16 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
sameeragcommented, Sep 16, 2022

@Robbie-Microsoft will be. We can reach out soon regarding the timeline, need to re-assess some of the other issues which are in the pipeline. Please watch out this space.

0reactions
bgavrilMScommented, Nov 7, 2022

The fix for this will be in the next release, 1.14.3 not 1.14.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple Matching Tokens Detected? - Stack Overflow
multiple_matching_tokens_detected: The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more ...
Read more >
ClientAuthError: multiple_matching_tokens error when cache ...
Call AcquireToken again providing more requirements such as authority or ... The cache contains multiple tokens satisfying the requirements.
Read more >
Multiple Matching Tokens Error - Azure SSO - Help Center
How to fix a 'multiple matching tokens error' when using Azure SSO. ... The cache contains multiple tokens satisfying the requirements," there is...
Read more >
Tip #1122: Multiple tokens in cache
multiple_matching_tokens_detected: The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more ...
Read more >
Cannot login using my work account - Visual Studio Feedback
AdalException: multiple_matching_tokens_detected: The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found