[QUERY] Identify token source for DefaultAzureCredential #17730
Labels
Azure.Identity
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
When calling one of the methods to obtain a token against a
DefaultAzureCredential
instance, multiple credential types will be tried, in order, as specified here. Once a token is obtained - from one of the credentials that were cycled through - is there a way to find out which type of credential "won"?An example: suppose when calling
DefaultAzureCrendetial's
GetTokenAsync method, it's theSharedTokenCacheCredential
that is able to retrieve one such token. Would one be able to determine that it was indeed aSharedTokenCacheCredential
that generated that token (eg either by looking at theDefaultAzureCrendetial
object, or on the resultingAzure.Core.AccessToken
result?I had a look at the code, and also debugged a bit, but wasn't able to come up with anything useful. I briefly thought about catching the exceptions that each credential might generate when
GetToken
/GetTokenAsync
isn't successful, but it appears those are not surfaced to the user's calling code.There's an SO thread here that asks a similar question, albeit for Python. It appears that there doesn't seem to be a solution there as well, aside from building a wrapper yourself using each type of credential.
The text was updated successfully, but these errors were encountered: