azure.communication.identity.aio package¶
-
class
azure.communication.identity.aio.
CommunicationIdentityClient
(endpoint: str, credential: AsyncTokenCredential, **kwargs)[source]¶ Azure Communication Services Identity client.
- Parameters
endpoint (str) – The endpoint url for Azure Communication Service resource.
credential (AsyncTokenCredential) – The AsyncTokenCredential we use to authenticate against the service.
Example:
-
async
close
() → None[source]¶ Close the :class: ~azure.communication.identity.aio.CommunicationIdentityClient session.
-
async
create_user
(**kwargs) → CommunicationUserIdentifier[source]¶ create a single Communication user
- Returns
CommunicationUserIdentifier
- Return type
-
async
create_user_and_token
(scopes: List[Union[str, CommunicationTokenScope]], **kwargs) → Tuple[CommunicationUserIdentifier, azure.core.credentials.AccessToken][source]¶ create a single Communication user with an identity token. :param scopes:
List of scopes to be added to the token.
- Returns
A tuple of a CommunicationUserIdentifier and a AccessToken.
- Return type
tuple of (CommunicationUserIdentifier, AccessToken)
-
async
delete_user
(user: azure.communication.identity._shared.models.CommunicationUserIdentifier, **kwargs) → None[source]¶ Triggers revocation event for user and deletes all its data.
- Parameters
user (CommunicationUserIdentifier) – Azure Communication User to delete
- Returns
None
- Return type
-
classmethod
from_connection_string
(conn_str: str, **kwargs) → azure.communication.identity.aio._communication_identity_client_async.CommunicationIdentityClient[source]¶ Create CommunicationIdentityClient from a Connection String.
- Parameters
conn_str (str) – A connection string to an Azure Communication Service resource.
- Returns
Instance of CommunicationIdentityClient.
- Return type
Example:
-
async
get_token
(user: azure.communication.identity._shared.models.CommunicationUserIdentifier, scopes: List[Union[str, CommunicationTokenScope]], **kwargs) → azure.core.credentials.AccessToken[source]¶ Generates a new token for an identity.
- Parameters
user (CommunicationUserIdentifier) – Azure Communication User
scopes (list[str or CommunicationTokenScope]) – List of scopes to be added to the token.
- Returns
AccessToken
- Return type
-
async
get_token_for_teams_user
(add_token: str, **kwargs) → azure.core.credentials.AccessToken[source]¶ Exchanges an AAD access token of a Teams User for a new Communication Identity access token.
- Parameters
add_token (str) – an AAD access token of a Teams User
- Returns
AccessToken
- Return type
-
async
revoke_tokens
(user: azure.communication.identity._shared.models.CommunicationUserIdentifier, **kwargs) → None[source]¶ Schedule revocation of all tokens of an identity.
- Parameters
user (CommunicationUserIdentifier) – Azure Communication User.
- Returns
None
- Return type