Closed tomkerkhove closed 1 day ago
https://github.com/Azure/azure-sdk-for-net/blob/d96e4ea52f6078e6e09d7933c6281ff94880d435/sdk/core/Azure.Core/src/Pipeline/BearerTokenAuthenticationPolicy.cs#L398C154-L398C191 is likely culprit where token.ExpiresOn
can be null
@christothes: Would you please take a look and offer your thoughts?
Hi @tomkerkhove -
I'm curious under which conditions the token contains a null ExpiresOn
value. We can certainly protect against throwing here, but this seems like an unexpected situation. Which credential type are you using?
Given we can use ITokenProvider, anyone can give a default(AccessToken)
or similar
Given we can use ITokenProvider, anyone can give a
default(AccessToken)
or similar
Do you have any ideas as to how this would be happening in your scenario?
I'd say when there is a bug, or when token could not be retried which would make it the default value
Thank you!
Library name and version
Azure.Core 1.42.0
Describe the bug
Using Azure.Messaging.EventGrid (4.24.0) to publish events which often fails due to BearerTokenAuthenticationPolicy throwing ArgumentOutOfRangeException (see below)
Expected behavior
Events to successfully emit to topic.
Actual behavior
Exception thrown:
Reproduction Steps
Not sure when this happens, likely after token expires or need new one here:
Environment
No response