A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/javascript/api/@azure/identity/chainedtokencredential below:

ChainedTokenCredential class | Microsoft Learn

ChainedTokenCredential class

Enables multiple TokenCredential implementations to be tried in order until one of the getToken methods returns an access token. For more information, see ChainedTokenCredential overview.

Constructor Details ChainedTokenCredential(TokenCredential[])

Creates an instance of ChainedTokenCredential using the given credentials.

new ChainedTokenCredential(sources: TokenCredential[])
Parameters
sources

TokenCredential[]

TokenCredential implementations to be tried in order.

Example usage:

import { ClientSecretCredential, ChainedTokenCredential } from "@azure/identity";

const tenantId = "<tenant-id>";
const clientId = "<client-id>";
const clientSecret = "<client-secret>";
const anotherClientId = "<another-client-id>";
const anotherSecret = "<another-client-secret>";

const firstCredential = new ClientSecretCredential(tenantId, clientId, clientSecret);
const secondCredential = new ClientSecretCredential(tenantId, anotherClientId, anotherSecret);

const credentialChain = new ChainedTokenCredential(firstCredential, secondCredential);
Method Details getToken(string | string[], GetTokenOptions)

Returns the first access token returned by one of the chained TokenCredential implementations. Throws an AggregateAuthenticationError when one or more credentials throws an AuthenticationError and no credentials have returned an access token.

This method is called automatically by Azure SDK client libraries. You may call this method directly, but you must also handle token caching and token refreshing.

function getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>
Parameters
scopes

string | string[]

The list of scopes for which the token will have access.

options
GetTokenOptions

The options used to configure any requests this TokenCredential implementation might make.

Returns

Promise<AccessToken>


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4