Options
All
  • Public
  • Public/Protected
  • All
Menu

@azure/communication-administration

Package version

Azure Communication Administration client library for JavaScript

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.

Getting started

Prerequisites

Installing

npm install @azure/communication-administration

Key concepts

CommunicationIdentityClient

CommunicationIdentityClient provides methods to manage users and their tokens.

Examples

Authentication

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:

Create KeyCredential with AzureKeyCredential before initializing CommunicationIdentityClient

import { AzureKeyCredential } from "@azure/core-auth";
import { CommunicationIdentityClient } from "@azure/communication-administration";

const credential = new AzureKeyCredential(KEY);
const client = new CommunicationIdentityClient(HOST, credential);

Using a connection string

import { CommunicationIdentityClient } from "@azure/communication-administration";

const connectionString = `endpoint=HOST;accessKey=KEY`;
const client = new CommunicationIdentityClient(connectionString);

Usage

Create a user and token

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"]);

Troubleshooting

Next steps

Please take a look at the [samples] directory for detailed examples on how to use this library.

Contributing

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.

Related projects

Impressions

Generated using TypeDoc