-
Notifications
You must be signed in to change notification settings - Fork 202
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
[Feature Request] Support force_refresh
for service principal
#650
Comments
This would be a consistency item with the rest of the MSALs, so approved. |
force_refresh
for service principalremove_tokens_for_client()
for service principal
remove_tokens_for_client()
for service principalremove_tokens_for_client()
for service principal
remove_tokens_for_client()
for service principalforce_refresh
for service principal
Sorry for changing the issue title back, as this issue is different from #649. Even after #666, we still need the functionality to force refresh. To utilize Suppose a user runs 2
Intuitively, the second command should make a new web request and overwrite app1's access token in the token cache, but currently a user should do:
|
Realistically, this behavior is expected. There is already a token for that SP. I believe PowerShell folks were also hit by similar issues, and decided to educate customers instead. I know that some apps (like SQL Server / Kusto) have decided to maintain a dictionary of (secret, CCA) or (cert.Thumbprint, CCA) in order to partition the cache by cert. |
MSAL client type
Confidential
Problem Statement
Azure CLI currently faces this issue:
The root cause is the behavior change of
acquire_token_for_client
.Before #581,
acquire_token_for_client
acquires an access token by making a web request to AAD eSTS. This forces MSAL to validate the service principals client ID and secrets against AAD eSTS. However, after this PR,acquire_token_for_client
will check the token cache first and return the access token if the service principals client ID matches what's in the token cache, thus skipping the web request.MSAL also forbids
force_refresh
to bypass the token cache, making it impossible to refresh the service principal token:microsoft-authentication-library-for-python/msal/application.py
Lines 2105 to 2108 in 3d3d02f
Proposed solution
It should be possible to
force_refresh
access tokens for service principals.The text was updated successfully, but these errors were encountered: