Edit

Share via


DeviceCodeClient class

OAuth2.0 Device code client

Extends
@azure/msal-common.BaseClient

Constructors

DeviceCodeClient(ClientConfiguration)

Inherited Properties

authority
logger

Methods

acquireToken(CommonDeviceCodeRequest)

Gets device code from device code endpoint, calls back to with device code response, and polls token endpoint to exchange device code for tokens

createExtraQueryParameters(CommonDeviceCodeRequest)

Creates query string for the device code request

Inherited Methods

createTokenQueryParameters(BaseAuthRequest)

Creates query string for the /token request

sendPostRequest<T>(RequestThumbprint, string, NetworkRequestOptions, string)

Wraps sendPostRequestAsync with necessary preflight and postflight logic

updateAuthority(string, string)

Updates the authority object of the client. Endpoint discovery must be completed.

Constructor Details

DeviceCodeClient(ClientConfiguration)

new DeviceCodeClient(configuration: ClientConfiguration)

Parameters

configuration
@azure/msal-common.ClientConfiguration

Inherited Property Details

authority

authority: Authority

Property Value

@azure/msal-common.Authority

Inherited From BaseClient.authority

logger

logger: Logger

Property Value

Inherited From BaseClient.logger

Method Details

acquireToken(CommonDeviceCodeRequest)

Gets device code from device code endpoint, calls back to with device code response, and polls token endpoint to exchange device code for tokens

function acquireToken(request: CommonDeviceCodeRequest): Promise<null | AuthenticationResult>

Parameters

request
@azure/msal-common.CommonDeviceCodeRequest

developer provided CommonDeviceCodeRequest

Returns

Promise<null | AuthenticationResult>

createExtraQueryParameters(CommonDeviceCodeRequest)

Creates query string for the device code request

function createExtraQueryParameters(request: CommonDeviceCodeRequest): string

Parameters

request
@azure/msal-common.CommonDeviceCodeRequest

developer provided CommonDeviceCodeRequest

Returns

string

Inherited Method Details

createTokenQueryParameters(BaseAuthRequest)

Creates query string for the /token request

function createTokenQueryParameters(request: BaseAuthRequest): string

Parameters

request
@azure/msal-common.BaseAuthRequest

Returns

string

Inherited From BaseClient.createTokenQueryParameters

sendPostRequest<T>(RequestThumbprint, string, NetworkRequestOptions, string)

Wraps sendPostRequestAsync with necessary preflight and postflight logic

function sendPostRequest<T>(thumbprint: RequestThumbprint, tokenEndpoint: string, options: NetworkRequestOptions, correlationId: string): Promise<NetworkResponse<T>>

Parameters

thumbprint
@azure/msal-common.RequestThumbprint

Request thumbprint for throttling

tokenEndpoint

string

Endpoint to make the POST to

options
NetworkRequestOptions

Body and Headers to include on the POST request

correlationId

string

CorrelationId for telemetry

Returns

Promise<NetworkResponse<T>>

Inherited From BaseClient.sendPostRequest

updateAuthority(string, string)

Updates the authority object of the client. Endpoint discovery must be completed.

function updateAuthority(cloudInstanceHostname: string, correlationId: string): Promise<void>

Parameters

cloudInstanceHostname

string

correlationId

string

Returns

Promise<void>

Inherited From BaseClient.updateAuthority