Skip to content

Bug: Missing kwargs in get_cached_refresh_tokens causes empty cache with enable_cae=True in _request_token #42045

Description

@q40603
  • Package Name: azure-identity
  • Package Version: 1.23.0, 1.23.1
  • Operating System: Ubuntu 22.04
  • Python Version: 3.13.4

Describe the bug
In the file azure/identity/aio/_credentials/on_behalf_of.py, within the function _request_token (line 122), the call to get_cached_refresh_tokens is missing the kwargs argument. This results in an empty cache when enable_cae is set to True.

To Reproduce
Steps to reproduce the behavior:

  1. Set enable_cae=True when obtaining a token using the OnBehalfOfCredential.
  2. Observe that token caching does not work as expected.
  3. Investigate the code path in _request_token and note that kwargs is not passed to get_cached_refresh_tokens.

Expected behavior
The cache should store and retrieve tokens correctly when enable_cae is enabled.

Additional context
Pass kwargs to get_cached_refresh_tokens in _request_token to ensure the cache key includes relevant options like enable_cae.

Reported based on direct code inspection and observed behavior.
File: azure/identity/aio/_credentials/on_behalf_of.py
Function: _request_token (line 122)
Impact: Token cache miss when enable_cae=True.

Metadata

Metadata

Assignees

Labels

Azure.IdentitybugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions