-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Identity] Silently refreshing tokens for DeviceCodeCredential #11128
Comments
@ms-kashyap thank you for reporting this, someone from our team will take a look at this //cc: @chlowell |
#10612 adds support for this and will be part of our next preview release, coming soon. With that PR, the credential will silently refresh tokens as needed. It also adds an in memory cache and optional disk cache on supported platforms (in this release, Windows). |
Great, thank you so much! |
Sorry, Had a follow up question. You mentioned that it the on-disk caching works on Windows only. What is the main reason this will not work on Linux, and are you planning to add support to other platforms besides Windows? |
The main reason is we haven't had an implementation for the cache anywhere else. We do now, and will add support for persistent caching on Linux and macOS. #11134 tracks that work. |
Awesome. Thank you so much for the quick responses, I appreciate it. Looking forward to the new features :) Go MS! |
In azure-identity 1.4.0b3, released today, Today's release also includes optional caching to disk on Windows when the credential is constructed with |
Is there a recommended way to force refresh of the DeviceCodeCredential at this point? Understood the DeviceCodeCredential class would be refreshed silently but want to see if there is a way we could force a refresh as well. |
The credential's |
Is your feature request related to a problem? Please describe.
Hi there, I am using the azure-identity library to authenticate a user using Device Code Login. After their access token expires after 60 minutes, I am unable to silently refresh this token.
Describe the solution you'd like
I would like to be able to silently refresh their access token once it is expired, so that they don't have to go through device code login again if they call my Python module after 60 minutes.
Describe alternatives you've considered
The Python adal library supports this, but I am unable to use it because I am using the new azure-keyvault-secrets library, which requires you to pass in a credential created by azure-identity.
Here's the API supported by adal library
Additionally, I tried calling internal APIs within azure-identity. I understand that both these APIs are meant to be used for application-delegated authentication instead of user-delegated.
Two that I looked at:
Additional context
Please let me know if you'd like for me to provide additional context.
One thing to note is that since the DeviceCodeCredential doesn't provide caching (i.e. each get_token() call starts a new flow), I created the wrapper class with an overridden get_token() that caches the token in memory and on disk.
The text was updated successfully, but these errors were encountered: