Edit

Share via


ClientCredentialClient class

OAuth2.0 client credential grant

Extends
@azure/msal-common.BaseClient

Constructors

ClientCredentialClient(ClientConfiguration, IAppTokenProvider)

Inherited Properties

authority
logger

Methods

acquireToken(CommonClientCredentialRequest)

Public API to acquire a token with ClientCredential Flow for Confidential clients

getCachedAuthenticationResult(CommonClientCredentialRequest, ClientConfiguration | ManagedIdentityConfiguration, ICrypto, Authority, CacheManager, null | ServerTelemetryManager)

looks up cache if the tokens are cached already

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

ClientCredentialClient(ClientConfiguration, IAppTokenProvider)

new ClientCredentialClient(configuration: ClientConfiguration, appTokenProvider?: IAppTokenProvider)

Parameters

configuration
@azure/msal-common.ClientConfiguration
appTokenProvider
IAppTokenProvider

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(CommonClientCredentialRequest)

Public API to acquire a token with ClientCredential Flow for Confidential clients

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

Parameters

request
@azure/msal-common.CommonClientCredentialRequest

CommonClientCredentialRequest provided by the developer

Returns

Promise<null | AuthenticationResult>

getCachedAuthenticationResult(CommonClientCredentialRequest, ClientConfiguration | ManagedIdentityConfiguration, ICrypto, Authority, CacheManager, null | ServerTelemetryManager)

looks up cache if the tokens are cached already

function getCachedAuthenticationResult(request: CommonClientCredentialRequest, config: ClientConfiguration | ManagedIdentityConfiguration, cryptoUtils: ICrypto, authority: Authority, cacheManager: CacheManager, serverTelemetryManager?: null | ServerTelemetryManager): Promise<[null | AuthenticationResult, CacheOutcome]>

Parameters

request
@azure/msal-common.CommonClientCredentialRequest
config

@azure/msal-common.ClientConfiguration | ManagedIdentityConfiguration

cryptoUtils
@azure/msal-common.ICrypto
authority
@azure/msal-common.Authority
cacheManager
@azure/msal-common.CacheManager
serverTelemetryManager

null | @azure/msal-common.ServerTelemetryManager

Returns

Promise<[null | AuthenticationResult, CacheOutcome]>

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