UsernamePasswordCredential Class

  • java.lang.Object
    • com.azure.identity.UsernamePasswordCredential

Implements

public class UsernamePasswordCredential
implements TokenCredential

An AAD credential that acquires a token with a username and a password. Users with 2FA/MFA (Multi-factored auth) turned on will not be able to use this credential. Please use DeviceCodeCredential or InteractiveBrowserCredential instead, or create a service principal if you want to authenticate silently.

Method Summary

Modifier and Type Method and Description
Mono<AuthenticationRecord> authenticate()

Authenticates the user using the specified username and password.

Mono<AuthenticationRecord> authenticate(TokenRequestContext request)

Authenticates the user using the specified username and password.

Mono<AccessToken> getToken(TokenRequestContext request)
AccessToken getTokenSync(TokenRequestContext request)

Methods inherited from java.lang.Object

Method Details

authenticate

public Mono authenticate()

Authenticates the user using the specified username and password.

Returns:

The AuthenticationRecord of the authenticated account.

authenticate

public Mono authenticate(TokenRequestContext request)

Authenticates the user using the specified username and password.

Parameters:

request - The details of the authentication request.

Returns:

The AuthenticationRecord of the authenticated account.

getToken

public Mono getToken(TokenRequestContext request)

Parameters:

request

getTokenSync

public AccessToken getTokenSync(TokenRequestContext request)

Parameters:

request

Applies to