DeviceCodeCredential Class

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

Implements

public class DeviceCodeCredential
implements TokenCredential

An AAD credential that acquires a token with a device code for an AAD application.

Method Summary

Modifier and Type Method and Description

Mono<AuthenticationRecord>

authenticate()

Authenticates a user via the device code flow.

Mono<AuthenticationRecord>

authenticate(TokenRequestContext request)

Authenticates a user via the device code flow.

Mono<AccessToken>

getToken(TokenRequestContext request)
AccessToken getTokenSync(TokenRequestContext request)

Methods inherited from java.lang.Object

Method Details

authenticate

public Mono authenticate()

Authenticates a user via the device code flow.

The credential acquires a verification URL and code from the Azure Active Directory. The user must browse to the URL, enter the code, and authenticate with Azure Active Directory. If the user authenticates successfully, the credential receives an access token.

Returns:

The AuthenticationRecord which can be used to silently authenticate the account on future execution if persistent caching was configured via tokenCachePersistenceOptions(TokenCachePersistenceOptions tokenCachePersistenceOptions) when credential was instantiated.

authenticate

public Mono authenticate(TokenRequestContext request)

Authenticates a user via the device code flow.

The credential acquires a verification URL and code from the Azure Active Directory. The user must browse to the URL, enter the code, and authenticate with Azure Active Directory. If the user authenticates successfully, the credential receives an access token.

Parameters:

request - The details of the authentication request.

Returns:

The AuthenticationRecord which can be used to silently authenticate the account on future execution if persistent caching was configured via tokenCachePersistenceOptions(TokenCachePersistenceOptions tokenCachePersistenceOptions) when credential was instantiated.

getToken

public Mono getToken(TokenRequestContext request)

Parameters:

request

getTokenSync

public AccessToken getTokenSync(TokenRequestContext request)

Parameters:

request

Applies to