CommunicationIdentityClient class

Client class for interacting with Azure Communication Services User Token Management.

Constructors

CommunicationIdentityClient(string, CommunicationIdentityOptions)

Initializes a new instance of the CommunicationIdentity class.

CommunicationIdentityClient(string, KeyCredential, CommunicationIdentityOptions)

Initializes a new instance of the CommunicationIdentity class using an Azure KeyCredential.

CommunicationIdentityClient(string, TokenCredential, CommunicationIdentityOptions)

Initializes a new instance of the CommunicationIdentity class using a TokenCredential.

Methods

createUser(OperationOptions)

Creates a single user.

deleteUser(CommunicationUserIdentifier, OperationOptions)

Triggers revocation event for user and deletes all its data.

issueToken(CommunicationUserIdentifier, TokenScope[], OperationOptions)

Creates a scoped user token.

revokeTokens(CommunicationUserIdentifier, Date, OperationOptions)

Revokes all data and tokens created for a user.

Constructor Details

CommunicationIdentityClient(string, CommunicationIdentityOptions)

Initializes a new instance of the CommunicationIdentity class.

new CommunicationIdentityClient(connectionString: string, options?: CommunicationIdentityOptions)

Parameters

connectionString

string

Connection string to connect to an Azure Communication Service resource. Example: "endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret";

options
CommunicationIdentityOptions

Optional. Options to configure the HTTP pipeline.

CommunicationIdentityClient(string, KeyCredential, CommunicationIdentityOptions)

Initializes a new instance of the CommunicationIdentity class using an Azure KeyCredential.

new CommunicationIdentityClient(url: string, credential: KeyCredential, options?: CommunicationIdentityOptions)

Parameters

url

string

The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).

credential
KeyCredential

An object that is used to authenticate requests to the service. Use the AzureKeyCredential or @azure/identity to create a credential.

options
CommunicationIdentityOptions

Optional. Options to configure the HTTP pipeline.

CommunicationIdentityClient(string, TokenCredential, CommunicationIdentityOptions)

Initializes a new instance of the CommunicationIdentity class using a TokenCredential.

new CommunicationIdentityClient(url: string, credential: TokenCredential, options?: CommunicationIdentityOptions)

Parameters

url

string

The endpoint of the service (ex: https://contoso.eastus.communications.azure.net)

credential
TokenCredential

TokenCredential that is used to authenticate requests to the service.

options
CommunicationIdentityOptions

Optional. Options to configure the HTTP pipeline.

Method Details

createUser(OperationOptions)

Creates a single user.

function createUser(options?: OperationOptions): Promise<CreateUserResponse>

Parameters

options
OperationOptions

Additional options for the request.

Returns

deleteUser(CommunicationUserIdentifier, OperationOptions)

Triggers revocation event for user and deletes all its data.

function deleteUser(user: CommunicationUserIdentifier, options?: OperationOptions): Promise<{ _response: HttpResponse }>

Parameters

user
CommunicationUserIdentifier

The user being deleted.

options
OperationOptions

Additional options for the request.

Returns

Promise<{ _response: HttpResponse }>

issueToken(CommunicationUserIdentifier, TokenScope[], OperationOptions)

Creates a scoped user token.

function issueToken(user: CommunicationUserIdentifier, scopes: TokenScope[], options?: OperationOptions): Promise<IssueTokenResponse>

Parameters

user
CommunicationUserIdentifier

The user whose tokens are being revoked.

scopes

TokenScope[]

Scopes to include in the token.

options
OperationOptions

Additional options for the request.

Returns

revokeTokens(CommunicationUserIdentifier, Date, OperationOptions)

Revokes all data and tokens created for a user.

function revokeTokens(user: CommunicationUserIdentifier, tokensValidFrom?: Date, options?: OperationOptions): Promise<{ _response: HttpResponse }>

Parameters

user
CommunicationUserIdentifier

The user whose tokens are being revoked.

tokensValidFrom

Date

Tokens issued before this time will be revoked.

options
OperationOptions

Additional options for the request.

Returns

Promise<{ _response: HttpResponse }>