-
Notifications
You must be signed in to change notification settings - Fork 3.4k
{Auth} Remove broker_error detection for re-authentication message
#31743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Cloud Shell,
az account get-access-token --scope non-existingtriggers a{'error': 'AudienceNotSupported', 'error_description': 'Audience non-existing is not a supported MSI token audience.'}.error.get('error') == 'broker_error'does not match this error.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this PR. Here comes more context about the "broker_error", for posterity.
In MSAL's underlying implementation, the
{"error": "broker_error", ...}was a necessary placeholder to normalize Cloud Shell's potential "deceivingly successful token response containing a mismatching token type" situation. It happened that the "broker_error" value was chosen (rather than inventing a "cloud_shell_error").Now looking back, if this error handling snippet in Azure CLI was meant to pinpoint that corner case, it should have used a more precise condition, something like this:
Now that the differentiation in
#2is no longer needed, yes let's simplify the implementation here to remove that "A if condition else B" usage. This change feels right because, even though an interactive login will NOT address all errors (certainly not the--scope NON-EXISTwrong usage), but at least the end user shall get a better error UI when interacting with Entra ID web pages.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The error handing is indeed to pinpoint Cloud Shell's potential "deceivingly successful token response containing a mismatching token type" situation, so we can use
if in_cloud_console() and error.get('error') == 'broker_errorto still handle this error.In the latest Cloud Shell, this error is no longer reproducible:
The
token_typein the response does match thetoken_typein the request, so there is no need to keep this error handing logic.