Skip to content

Conversation

@pvaneck
Copy link
Member

@pvaneck pvaneck commented Dec 4, 2025

Closes: #44234

Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
@pvaneck pvaneck marked this pull request as ready for review December 4, 2025 23:37
@pvaneck pvaneck requested a review from xiangyan99 as a code owner December 4, 2025 23:37
Copilot AI review requested due to automatic review settings December 4, 2025 23:37
@pvaneck pvaneck requested a review from a team as a code owner December 4, 2025 23:37
Copilot finished reviewing on behalf of pvaneck December 4, 2025 23:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a TypeError that occurred when Microsoft Entra ID returned certain non-JSON responses (specifically None content). The fix adds defensive handling to catch this case early and raise a more helpful ClientAuthenticationError instead of allowing the code to fail with a TypeError when trying to call .get() on None.

Key Changes

  • Added early validation in _process_response to check for None/empty content before attempting to use it
  • Added a test case to verify the fix handles None content properly
  • Updated CHANGELOG.md to document the bug fix

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
sdk/identity/azure-identity/azure/identity/_internal/aad_client_base.py Added if not content: check to raise ClientAuthenticationError early when response content is None or empty
sdk/identity/azure-identity/tests/test_aad_client.py Added test_none_content_handling to verify None content is handled without TypeError
sdk/identity/azure-identity/CHANGELOG.md Documented the bug fix with reference to PR #44258

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

Argument of type 'NoneType' is not iterable - azure-identity get_token

1 participant