> For the complete documentation index, see [llms.txt](https://docs.jianny.net/work/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jianny.net/work/azure/app-registration-auths/graph-ropc-federated-account/msal-usernamepasswordcredential.md).

# MSAL UsernamePasswordCredential

{% hint style="info" %}
**UsernamePasswordCredential** in <https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity?view=azure-python>

Authenticates a user with a username and password.

Microsoft doesn't recommend this kind of authentication because it's less secure than other authentication flows.

Authentication with this credential is not interactive, so it is **incompatible with multi-factor authentication or consent prompting**. The application must already have consent from the user or a directory admin.

This credential can only authenticate work and school accounts; Microsoft accounts are not supported. See [Azure Active Directory documentation](https://learn.microsoft.com/en-us/azure/active-directory/fundamentals/sign-up-organization) for more information about account types.
{% endhint %}

More examples regarding using automated SAML assertion to retrieve OAuth tokens in [Java](/work/azure/app-registration-auths/graph-ropc-federated-account/java.md)and [Python](/work/azure/app-registration-auths/graph-ropc-federated-account/python.md)
