Share via


TokenCredentialsBase class

Constructors

TokenCredentialsBase(string, string, string, Environment, TokenCache)

Properties

authContext
clientId
domain
environment
tokenAudience
tokenCache

Methods

getToken()

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

setDomain(string)
signRequest(WebResource)

Signs a request with the Authentication header.

Constructor Details

TokenCredentialsBase(string, string, string, Environment, TokenCache)

new TokenCredentialsBase(clientId: string, domain: string, tokenAudience?: string, environment?: Environment, tokenCache?: TokenCache)

Parameters

clientId

string

domain

string

tokenAudience

string

environment
Environment
tokenCache

TokenCache

Property Details

authContext

authContext: AuthenticationContext

Property Value

AuthenticationContext

clientId

clientId: string

Property Value

string

domain

domain: string

Property Value

string

environment

environment: Environment

Property Value

tokenAudience

tokenAudience?: string

Property Value

string

tokenCache

tokenCache: TokenCache

Property Value

TokenCache

Method Details

getToken()

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

function getToken(): Promise<TokenResponse>

Returns

Promise<TokenResponse>

The tokenResponse (tokenType and accessToken are the two important properties).

setDomain(string)

function setDomain(domain: string)

Parameters

domain

string

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>