Cannot authenticate with Azure after password reset: AADSTS50173: The provided grant has expired due to it being revoked

Craig Blackman 25 Reputation points
2023-05-12T14:54:27.72+00:00

Using Intellij to run a Spring Boot app that needs to authenticate with Azure to access a key vault. I reset my password and login successfully on to the az cli using the az-login command. However it claims I need a new token. I have run az logout and az account clear multiple times. Also deleted msal.cache and msal-token_-_cache.json on my local machine but nothing helps. Exception is:

	Suppressed: com.azure.core.exception.ClientAuthenticationException: DefaultAzureCredential authentication failed. ---> IntelliJCredential authentication failed. Error Details: AADSTS50173: The provided grant has expired due to it being revoked, a fresh auth token is needed. The user might have changed or reset their password. The grant was issued on '2022-12-01T17:06:18.9958813Z' and the TokensValidFrom date (before which tokens are not valid) for this user is '2023-05-02T08:14:11.0000000Z'.

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,451 questions
Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

Accepted answer
  1. Shweta Mathur 30,296 Reputation points Microsoft Employee Moderator
    2023-05-18T09:27:52.83+00:00

    Hi @Craig Blackman ,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I'll repost your solution in case you'd like to "Accept" the answer.

    User's image

    Thanks

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Sedat SALMAN 14,180 Reputation points MVP
    2023-05-13T18:16:54.2733333+00:00

    The error you're encountering (AADSTS50173) indicates that Azure Active Directory (Azure AD) received a token in a request, but the token is no longer valid due to a password change. The token might have been cached by your application or the library you're using to authenticate.

    Go to your IntelliJ IDEA's system directory. It's usually located in the user's home directory:

    • Windows: C:\Users<Your User Name>.IntelliJIdea<version>\system
    • macOS: ~/Library/Caches/JetBrains/IntelliJIdea<version>
    • Linux: ~/.cache/JetBrains/IntelliJIdea<version>

    Delete the azure directory inside the plugins directory, which is located inside the system directory. This should clear IntelliJ IDEA's Azure plugin cache.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.