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

[Feature Request] Support --force-refresh in az account get-access-token #17578

Open
jiasli opened this issue Apr 6, 2021 · 3 comments
Open
Assignees
Labels
Milestone

Comments

@jiasli
Copy link
Member

jiasli commented Apr 6, 2021

Requirement

There are some use cases where the user wants to get a new/fresh access token, bypassing the ADAL/MSAL token cache.

More info at Azure/azure-powershell#14005.

Proposed solution

Support --force-refresh in az account get-access-token.

Additional context

ADAL doesn’t support force_refresh:

https://github.com/AzureAD/azure-activedirectory-library-for-python/blob/7dddec09ebeec853986d1f0e66eb5469afb2ccbc/adal/authentication_context.py#L130

    def acquire_token(self, resource, user_id, client_id):

MSAL supports force_refresh:

https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/53b99957201b5bea299c91fe634e830535b2ad8f/msal/application.py#L519

    def acquire_token_silent(
            self,
            scopes,  # type: List[str]
            account,  # type: Optional[Account]
            authority=None,  # See get_authorization_request_url()
            force_refresh=False,  # type: Optional[boolean]
            claims_challenge=None,
            **kwargs):
@ghost ghost added the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Apr 6, 2021
@yonzhan yonzhan added the Account az login/account label Apr 6, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Apr 6, 2021
@yonzhan yonzhan added feature-request needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Apr 6, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Apr 6, 2021
@yonzhan yonzhan added this to the S186 milestone Apr 6, 2021
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 6, 2021

support force-refresh

@yonzhan yonzhan modified the milestones: S186, S187 Apr 9, 2021
@yonzhan yonzhan modified the milestones: S187, Backlog May 9, 2021
@bennyb518
Copy link

bennyb518 commented Mar 23, 2022

you can do the following as a temporary solution to re-generate the access token:
az account clear
re-login and then execute get-access-token again

@johschmidt42
Copy link

you can do the following as a temporary solution to re-generate the access token: az account clear re-login and then execute get-access-token again

Thanks, az account clear && az login saved my day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants