Edit

Share via


UsernamePasswordClient class

Warning

This API is now deprecated.

  • Use a more secure flow instead

Oauth2.0 Password grant client Note: We are only supporting public clients for password grant and for purely testing purposes

Extends
@azure/msal-common.BaseClient

Constructors

UsernamePasswordClient(ClientConfiguration)

Inherited Properties

authority
logger

Methods

acquireToken(CommonUsernamePasswordRequest)

API to acquire a token by passing the username and password to the service in exchage of credentials password_grant

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

UsernamePasswordClient(ClientConfiguration)

new UsernamePasswordClient(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(CommonUsernamePasswordRequest)

API to acquire a token by passing the username and password to the service in exchage of credentials password_grant

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

Parameters

request
@azure/msal-common.CommonUsernamePasswordRequest

CommonUsernamePasswordRequest

Returns

Promise<null | AuthenticationResult>

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