Fix and enhance auto-prompt to clear Entra token cache on multiple matching tokens error #19881
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a critical bug and enhances the user experience when encountering the
multiple_matching_tokens_detected
error during Active Directory Interactive authentication.Problem
Users experiencing the "multiple matching tokens detected" error (shown in the issue screenshot) faced two major problems:
Currently, users had to manually run
MS SQL: Clear Microsoft Entra account token cache
from the command palette, but even the built-in error dialog was non-functional.Solution
🐛 Critical Bug Fix
Fixed the button response checking in
msalAzureController.ts
. The code was checking forLocalizedConstants.msgYes
but the actual button passed wasLocalizedConstants.ConnectionDialog.ClearCacheAndRefreshToken
.🎨 Enhanced User Experience
⚙️ Auto-Clear Configuration
Added new setting
mssql.azureAutoClearTokenCache
that allows users to automatically clear the token cache without prompting when this error occurs.User flow:
📝 Configuration Details
Impact
This transforms a frustrating technical error into a guided, self-healing experience:
The feature respects user preferences by defaulting to manual approval but allows power users to enable full automation.
Fixes #19733.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
update.code.visualstudio.com
/usr/local/bin/node ./out/test/unit/runTest.js
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.