Troubleshoot user credential authentication

This article provides guidance on dealing with issues encountered when authenticating Azure SDK for Java applications with user-provided credentials, through various TokenCredential implementations. For more information, see Azure authentication with user credentials.

Troubleshoot UsernamePasswordCredential

When you use UsernamePasswordCredential, you can optionally try/catch for ClientAuthenticationException. The following table shows the errors that this exception indicates, and methods of mitigation:

Error code Issue Mitigation
AADSTS50126 The provided username or password is invalid Ensure that the username and password provided when constructing the credential are valid.

Next steps

If the troubleshooting guidance in this article doesn't help to resolve issues when you use the Azure SDK for Java client libraries, we recommended that you file an issue in the Azure SDK for Java GitHub repository.