azure.communication.identity.aio package

class azure.communication.identity.aio.CommunicationIdentityClient(endpoint: str, credential: AsyncTokenCredential, **kwargs: Any)[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) → azure.communication.identity._shared.models.CommunicationUserIdentifier[source]

create a single Communication user

Returns

CommunicationUserIdentifier

Return type

CommunicationUserIdentifier

async create_user_and_token(scopes: List[Union[str, ‘_model.CommunicationTokenScope’]], **kwargs: Any) → Tuple[CommunicationUserIdentifier, 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(communication_user: CommunicationUserIdentifier, **kwargs: Any)None[source]

Triggers revocation event for user and deletes all its data.

Parameters

communication_user (CommunicationUserIdentifier) – Azure Communication User to delete

Returns

None

Return type

None

classmethod from_connection_string(conn_str: str, **kwargs: Any) → 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

CommunicationIdentityClient

Example:

async get_token(user: CommunicationUserIdentifier, scopes: List[Union[str, ‘_model.CommunicationTokenScope’]], **kwargs: Any) → AccessToken[source]

Generates a new token for an identity.

Parameters
Returns

AccessToken

Return type

AccessToken

async revoke_tokens(user: CommunicationUserIdentifier, **kwargs: Any)None[source]

Schedule revocation of all tokens of an identity.

Parameters

user (CommunicationUserIdentifier) – Azure Communication User.

Returns

None

Return type

None