The Azure Communication Administration library lets the developer create/delete users and issue tokens for Communication Services. Users and tokens can then be used when adding Chat or Calling to an app.
npm install @azure/communication-administration
CommunicationIdentityClient
provides methods to manage users and their tokens.
You can get a key and/or connection string from your Communication Services resource in Azure Portal. Once you have a key, you may authenticate with any of the following methods:
KeyCredential
with AzureKeyCredential
before initializing CommunicationIdentityClientimport { AzureKeyCredential } from "@azure/core-auth";
import { CommunicationIdentityClient } from "@azure/communication-administration";
const credential = new AzureKeyCredential(KEY);
const client = new CommunicationIdentityClient(HOST, credential);
import { CommunicationIdentityClient } from "@azure/communication-administration";
const connectionString = `endpoint=HOST;accessKey=KEY`;
const client = new CommunicationIdentityClient(connectionString);
Here we create an instance of the CommunicationIdentityClient
class, create a user, then issue a chat scoped token for the user.
import { CommunicationIdentityClient } from "@azure/communication-administration";
const client = new CommunicationIdentityClient(CONNECTION_STRING);
const user = await client.createUser();
const { token } = await client.issueToken(user, ["chat"]);
Please take a look at the [samples] directory for detailed examples on how to use this library.
If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.
Generated using TypeDoc