你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

CommunicationTokenCredential Class

Credential type used for authenticating to an Azure Communication service.

Constructor

CommunicationTokenCredential(token: str, **kwargs: Any)

Parameters

Name Description
token
Required
str

The token used to authenticate to an Azure Communication service.

Keyword-Only Parameters

Name Description
token_refresher
Callable[[], <xref:AccessToken>]

The sync token refresher to provide capacity to fetch a fresh token. The returned token must be valid (expiration date must be in the future).

proactive_refresh

Whether to refresh the token proactively or not. If the proactive refreshing is enabled ('proactive_refresh' is true), the credential will use a background thread to attempt to refresh the token within 10 minutes before the cached token expires, the proactive refresh will request a new token by calling the 'token_refresher' callback. When 'proactive_refresh' is enabled, the Credential object must be either run within a context manager or the 'close' method must be called once the object usage has been finished.

Methods

close
get_token

The value of the configured token. :param any scopes: Scopes to be added to the token. :return: AccessToken :rtype: ~azure.core.credentials.AccessToken

close

close() -> None

get_token

The value of the configured token. :param any scopes: Scopes to be added to the token. :return: AccessToken :rtype: ~azure.core.credentials.AccessToken

get_token(*scopes, **kwargs)