Share via


MsalTokenCredential class

Token credential implementation that uses MSAL (Microsoft Authentication Library) to acquire access tokens. Implements the Azure Core Auth TokenCredential interface for authentication scenarios.

Constructors

MsalTokenCredential(AuthConfiguration)

Creates a new instance of MsalTokenCredential.

Methods

getToken(string[], GetTokenOptions)

Retrieves an access token for the specified scopes using MSAL authentication.

Constructor Details

MsalTokenCredential(AuthConfiguration)

Creates a new instance of MsalTokenCredential.

new MsalTokenCredential(authConfig: AuthConfiguration)

Parameters

authConfig
AuthConfiguration

The authentication configuration to use for token acquisition.

Method Details

getToken(string[], GetTokenOptions)

Retrieves an access token for the specified scopes using MSAL authentication.

function getToken(scopes: string[], options?: GetTokenOptions): Promise<{ expiresOnTimestamp: number, token: string }>

Parameters

scopes

string[]

Array of scopes for which to request an access token. The first scope is used to determine the resource.

options
GetTokenOptions

Optional parameters for token retrieval (currently unused).

Returns

Promise<{ expiresOnTimestamp: number, token: string }>

Promise that resolves to an access token with expiration timestamp.