CertificateAppCredentials class

CertificateAppCredentials auth implementation

Extends

Constructors

CertificateAppCredentials(string, string, string, string, string)

Initializes a new instance of the CertificateAppCredentials class.

Properties

certificatePrivateKey
certificateThumbprint
oAuthEndpoint

Gets the OAuth endpoint to use. Sets the OAuth endpoint to use.

oAuthScope

Gets the OAuth scope to use. Sets the OAuth scope to use.

Inherited Properties

appId
tokenCacheKey

Inherited Methods

getToken(boolean)

Gets an OAuth access token.

isTrustedServiceUrl(string)

Checks if the service url is for a trusted host or not.

signRequest(WebResource)

Apply the credentials to the HTTP request.

trustServiceUrl(string, Date)

Adds the host of service url to trusted hosts. If expiration time is not provided, the expiration date will be current (utc) date + 1 day.

Constructor Details

CertificateAppCredentials(string, string, string, string, string)

Initializes a new instance of the CertificateAppCredentials class.

new CertificateAppCredentials(appId: string, certificateThumbprint: string, certificatePrivateKey: string, channelAuthTenant?: string, oAuthScope?: string)

Parameters

appId

string

Microsoft application Id related to the certificate.

certificateThumbprint

string

A hex encoded thumbprint of the certificate.

certificatePrivateKey

string

A PEM encoded certificate private key.

channelAuthTenant

string

Optional. The oauth token tenant.

oAuthScope

string

Optional. The scope for the token.

Property Details

certificatePrivateKey

certificatePrivateKey: string

Property Value

string

certificateThumbprint

certificateThumbprint: string

Property Value

string

oAuthEndpoint

Gets the OAuth endpoint to use. Sets the OAuth endpoint to use.

string oAuthEndpoint

Property Value

string

The OAuthEndpoint to use.

oAuthScope

Gets the OAuth scope to use. Sets the OAuth scope to use.

string oAuthScope

Property Value

string

The OAuth scope to use.

Inherited Property Details

appId

appId: string

Property Value

string

Inherited From AppCredentials.appId

tokenCacheKey

tokenCacheKey: string

Property Value

string

Inherited From AppCredentials.tokenCacheKey

Inherited Method Details

getToken(boolean)

Gets an OAuth access token.

function getToken(forceRefresh?: boolean): Promise<string>

Parameters

forceRefresh

boolean

True to force a refresh of the token; or false to get a cached token if it exists.

Returns

Promise<string>

A Promise that represents the work queued to execute.

Remarks

If the promise is successful, the result contains the access token string.

Inherited From AppCredentials.getToken

isTrustedServiceUrl(string)

Warning

This API is now deprecated.

Checks if the service url is for a trusted host or not.

static function isTrustedServiceUrl(serviceUrl: string): boolean

Parameters

serviceUrl

string

The service url

Returns

boolean

True if the host of the service url is trusted; False otherwise.

Inherited From AppCredentials.isTrustedServiceUrl

signRequest(WebResource)

Apply the credentials to the HTTP request.

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

Parameters

webResource

WebResource

The WebResource HTTP request.

Returns

Promise<WebResource>

A Promise representing the asynchronous operation.

Inherited From AppCredentials.signRequest

trustServiceUrl(string, Date)

Warning

This API is now deprecated.

Adds the host of service url to trusted hosts. If expiration time is not provided, the expiration date will be current (utc) date + 1 day.

static function trustServiceUrl(serviceUrl: string, expiration?: Date)

Parameters

serviceUrl

string

The service url

expiration

Date

Inherited From AppCredentials.trustServiceUrl