ChainedTokenCredential Class

A sequence of credentials that is itself a credential.

Its get_token method calls get_token on each credential in the sequence, in order, returning the first valid token received.

Inheritance
azure.identity.aio._internal.AsyncContextManager
ChainedTokenCredential

Constructor

ChainedTokenCredential(*credentials: AsyncTokenCredential)

Parameters

credentials
<xref:azure.core.credentials.AsyncTokenCredential>
Required

credential instances to form the chain

Methods

close

Close the transport sessions of all credentials in the chain.

get_token

Asynchronously request a token from each credential, in order, returning the first token received.

If no credential provides a token, raises ClientAuthenticationError with an error message from each credential.

This method is called automatically by Azure SDK clients.

close

Close the transport sessions of all credentials in the chain.

async close()

get_token

Asynchronously request a token from each credential, in order, returning the first token received.

If no credential provides a token, raises ClientAuthenticationError with an error message from each credential.

This method is called automatically by Azure SDK clients.

async get_token(*scopes: str, **kwargs: Any) -> AccessToken

Parameters

scopes
str
Required

desired scopes for the access token. This method requires at least one scope.

Exceptions

no credential in the chain provided a token