CommunicationTokenCredential Class
Credential type used for authenticating to an Azure Communication service.
Constructor
CommunicationTokenCredential(token: str, **kwargs: Any)
Parameters
| Name | Description |
|---|---|
|
token
Required
|
The token used to authenticate to an Azure Communication service. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
token_refresher
|
The async 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. |
close
async close() -> None
get_token
The value of the configured token.
async get_token(*scopes, **kwargs)
Parameters
| Name | Description |
|---|---|
|
scopes
Required
|
Scopes to be added to the token. |
Returns
| Type | Description |
|---|---|
|
AccessToken |