ApplicationTokenCredentials class

Extends

ApplicationTokenCredentialsBase

Constructors

ApplicationTokenCredentials(string, string, string, TokenAudience, Environment, TokenCache)

Creates a new ApplicationTokenCredentials object. See Active Directory Quickstart for .Net for detailed instructions on creating an Azure Active Directory application.

Properties

secret

Inherited Properties

authContext
clientId
domain
environment
tokenAudience
tokenCache

Methods

getToken()

Tries to get the token from cache initially. If that is unsuccessfull then it tries to get the token from ADAL.

Inherited Methods

setDomain(string)
signRequest(WebResource)

Signs a request with the Authentication header.

Constructor Details

ApplicationTokenCredentials(string, string, string, TokenAudience, Environment, TokenCache)

Creates a new ApplicationTokenCredentials object. See Active Directory Quickstart for .Net for detailed instructions on creating an Azure Active Directory application.

new ApplicationTokenCredentials(clientId: string, domain: string, secret: string, tokenAudience?: TokenAudience, environment?: Environment, tokenCache?: TokenCache)

Parameters

clientId

string

The active directory application client id.

domain

string

The domain or tenant id containing this application.

secret

string

The authentication secret for the application.

tokenAudience
TokenAudience

The audience for which the token is requested. Valid values are 'graph', 'batch', or any other resource like 'https://vault.azure.net/'. If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferrably in a guid format).

environment
Environment

The azure environment to authenticate with.

tokenCache

TokenCache

The token cache. Default value is the MemoryCache object from adal.

Property Details

secret

secret: string

Property Value

string

Inherited Property Details

authContext

authContext: AuthenticationContext

Property Value

AuthenticationContext

Inherited From ApplicationTokenCredentialsBase.authContext

clientId

clientId: string

Property Value

string

Inherited From ApplicationTokenCredentialsBase.clientId

domain

domain: string

Property Value

string

Inherited From ApplicationTokenCredentialsBase.domain

environment

environment: Environment

Property Value

Inherited From ApplicationTokenCredentialsBase.environment

tokenAudience

tokenAudience?: string

Property Value

string

Inherited From ApplicationTokenCredentialsBase.tokenAudience

tokenCache

tokenCache: TokenCache

Property Value

TokenCache

Inherited From ApplicationTokenCredentialsBase.tokenCache

Method Details

getToken()

Tries to get the token from cache initially. If that is unsuccessfull then it tries to get the token from ADAL.

function getToken(): Promise<TokenResponse>

Returns

Promise<TokenResponse>

A promise that resolves to TokenResponse and rejects with an Error.

Inherited Method Details

setDomain(string)

function setDomain(domain: string)

Parameters

domain

string

Inherited From ApplicationTokenCredentialsBase.setDomain

signRequest(WebResource)

Signs a request with the Authentication header.

function signRequest(webResource: WebResource): Promise<WebResource>

Parameters

webResource
WebResource

The WebResource to be signed.

Returns

Promise<WebResource>

Inherited From ApplicationTokenCredentialsBase.signRequest