CommunicationIdentityClient class
Client class for interacting with Azure Communication Services User Token Management.
Constructors
Communication |
Initializes a new instance of the CommunicationIdentity class. |
Communication |
Initializes a new instance of the CommunicationIdentity class using an Azure KeyCredential. |
Communication |
Initializes a new instance of the CommunicationIdentity class using a TokenCredential. |
Methods
create |
Creates a single user. |
create |
Creates a single user and a token simultaneously. |
delete |
Triggers revocation event for user and deletes all its data. |
get |
Creates a scoped user token. |
get |
Exchanges an Azure AD access token of a Teams user for a new Communication Identity access token with a matching expiration time. |
revoke |
Revokes all data and tokens created for a user. |
Constructor Details
CommunicationIdentityClient(string, CommunicationIdentityClientOptions)
Initializes a new instance of the CommunicationIdentity class.
new CommunicationIdentityClient(connectionString: string, options?: CommunicationIdentityClientOptions)
Parameters
- connectionString
-
string
Connection string to connect to an Azure Communication Service resource. Example: "endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret";
Optional. Options to configure the HTTP pipeline.
CommunicationIdentityClient(string, KeyCredential, CommunicationIdentityClientOptions)
Initializes a new instance of the CommunicationIdentity class using an Azure KeyCredential.
new CommunicationIdentityClient(endpoint: string, credential: KeyCredential, options?: CommunicationIdentityClientOptions)
Parameters
- endpoint
-
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.
Optional. Options to configure the HTTP pipeline.
CommunicationIdentityClient(string, TokenCredential, CommunicationIdentityClientOptions)
Initializes a new instance of the CommunicationIdentity class using a TokenCredential.
new CommunicationIdentityClient(endpoint: string, credential: TokenCredential, options?: CommunicationIdentityClientOptions)
Parameters
- endpoint
-
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.
Optional. Options to configure the HTTP pipeline.
Method Details
createUser(OperationOptions)
Creates a single user.
function createUser(options?: OperationOptions): Promise<CommunicationUserIdentifier>
Parameters
- options
- OperationOptions
Additional options for the request.
Returns
Promise<CommunicationUserIdentifier>
createUserAndToken(TokenScope[], CreateUserAndTokenOptions)
Creates a single user and a token simultaneously.
function createUserAndToken(scopes: TokenScope[], options?: CreateUserAndTokenOptions): Promise<CommunicationUserToken>
Parameters
- scopes
Scopes to include in the token.
- options
- CreateUserAndTokenOptions
Additional options for the request.
Returns
Promise<CommunicationUserToken>
deleteUser(CommunicationUserIdentifier, OperationOptions)
Triggers revocation event for user and deletes all its data.
function deleteUser(user: CommunicationUserIdentifier, options?: OperationOptions): Promise<void>
Parameters
The user being deleted.
- options
- OperationOptions
Additional options for the request.
Returns
Promise<void>
getToken(CommunicationUserIdentifier, TokenScope[], GetTokenOptions)
Creates a scoped user token.
function getToken(user: CommunicationUserIdentifier, scopes: TokenScope[], options?: GetTokenOptions): Promise<CommunicationAccessToken>
Parameters
The user whose tokens are being issued.
- scopes
Scopes to include in the token.
- options
- GetTokenOptions
Additional options for the request.
Returns
Promise<CommunicationAccessToken>
getTokenForTeamsUser(GetTokenForTeamsUserOptions)
Exchanges an Azure AD access token of a Teams user for a new Communication Identity access token with a matching expiration time.
function getTokenForTeamsUser(options: GetTokenForTeamsUserOptions): Promise<CommunicationAccessToken>
Parameters
- options
- GetTokenForTeamsUserOptions
Options used to exchange an Azure AD access token of a Teams user for a new Communication Identity access token.
Returns
Promise<CommunicationAccessToken>
revokeTokens(CommunicationUserIdentifier, OperationOptions)
Revokes all data and tokens created for a user.
function revokeTokens(user: CommunicationUserIdentifier, options?: OperationOptions): Promise<void>
Parameters
The user whose tokens are being revoked.
- options
- OperationOptions
Additional options for the request.
Returns
Promise<void>