Skip to content
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

Add caching to DeviceCodeCredential #11043

Closed
letmaik opened this issue Apr 24, 2020 · 7 comments · Fixed by #10612
Closed

Add caching to DeviceCodeCredential #11043

letmaik opened this issue Apr 24, 2020 · 7 comments · Fixed by #10612
Assignees
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. feature-request This issue requires a new behavior in the product in order be resolved.
Milestone

Comments

@letmaik
Copy link

letmaik commented Apr 24, 2020

I can't use the interactive browser credential (which does cache) as I'm connected to a VM via SSH. Since the device code flow serves the same purpose it should also support caching.

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 24, 2020
@chlowell
Copy link
Member

Thanks for opening this issue. DeviceCodeCredential and InteractiveBrowserCredential will have the same caching behavior in the next preview release (#10612 makes the necessary changes).

@chlowell chlowell added Azure.Identity Client This issue points to a problem in the data-plane of the library. feature-request This issue requires a new behavior in the product in order be resolved. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 24, 2020
@chlowell chlowell self-assigned this Apr 24, 2020
@chlowell chlowell removed the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Apr 24, 2020
@letmaik
Copy link
Author

letmaik commented Apr 24, 2020

The PR says caching is only supported on Windows. That makes it kind of useless for me and I'm sure many others. Can Linux/macOS be added as well?

@chlowell
Copy link
Member

Persistent caching to disk is only supported on Windows today but with that pull request the credentials will fall back to an in memory cache on other platforms, which is what I believe you're asking for. I'm sorry the PR isn't explicit on that point.

@letmaik
Copy link
Author

letmaik commented Apr 24, 2020

Persistent caching would be ideal and is what I'm really looking for. The Azure ML folks monkey-patch and piggy-back on the Azure CLI package to get persistence, but obviously that's not great and I can't do the same. Would it be possible to add Linux support to this PR? As far as I see, it would just be a matter of picking another caching folder, like ~/.azure-identity-service/msal-cache.

@chlowell
Copy link
Member

We've been waiting until we can encrypt the cache on Linux. AzureAD/microsoft-authentication-extensions-for-python#44 has initial support for that, with the limitation that it requires libsecret and so probably doesn't work in your SSH session. When we do support persistence on Linux, the cache will be encrypted by default with an explicit opt out. API changes to enable that will come in a future PR.

@letmaik
Copy link
Author

letmaik commented Apr 24, 2020

OK sounds good. For the record, I'm fine with storing the tokens in an unencrypted file as fall-back.

@chlowell
Copy link
Member

chlowell commented May 4, 2020

In azure-identity 1.4.0b3, released today, DeviceCodeCredential has an in memory cache and will silently refresh tokens as needed. Please open an issue if you encounter any problems using it.

Today's release also includes optional caching to disk on Windows when the credential is constructed with enable_persistent_cache=True. We'll add persistent caching on Linux and macOS in a future release (that work is tracked by #11134).

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. feature-request This issue requires a new behavior in the product in order be resolved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants