Skip to content

[Identity] Fix TypeError from certain Entra responses - #44258

Merged
Paul Van Eck (pvaneck) merged 1 commit into
Azure:mainfrom
pvaneck:identity-nonetype
Jan 13, 2026
Merged

Paul Van Eck (pvaneck) merged 1 commit into
Azure:mainfrom
pvaneck:identity-nonetype

Conversation

@pvaneck

Copy link
Copy Markdown
Member

Closes: #44234

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread sdk/identity/azure-identity/tests/test_aad_client.py
@github-project-automation github-project-automation Bot moved this from Untriaged to In Progress in Azure Identity SDK Improvements Jan 13, 2026
Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
@pvaneck
Paul Van Eck (pvaneck) merged commit 2ae98ca into Azure:main Jan 13, 2026
22 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure Identity SDK Improvements Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

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

3 participants