atmoky Engage Server SDK is now available! Check out the documentation to learn more.
Token Creation

Creating an Access Token

Using key and secret that are associated with your customer account, you can use the Server SDK to create an access token for joining a Room. The following example shows how to create a token, allowing a participant to join, publish, and subscribe to other participants inside the Room.
import { AccessToken } from "@atmokyaudio/engage-server-sdk";
const participantName = "<name_of_participant>";
const roomName = "<name_of_room>";
const accessToken = new AccessToken("<api_key>", "<api_secret>", {
    identity: participantName,
    roomJoin: true,
    room: roomName,
    canPublish: true,
    canSubscribe: true,
const token = accessToken.toJwt();
Keep key and secret safe and do not embed them in client-side applications. If an unauthorized entity manages to get access to key and secret, they will be able to grant themselves access to any Rooms associated with the customer account.

Command Line Interface

For development use, the ServerSDK also has a command line interface so you don't need to run a full-fledged authentication server to generate a token:
npx atmoky-engage create-token \
  --key <key> \
  --secret <secret>
You can also pass optional parameters to the CLI:
npx atmoky-engage create-token \
  --key <key> \
  --secret <secret> \
  --ttl <ttl> \
  --room <roomName> \
  --participant <participantName>
By default, the following grants are currently set for tokens created from the CLI:
  • Publish
  • Subscribe
  • Join room
  • List rooms
These can be disabled individually:
npx atmoky-engage create-token \
  --key foo \
  --secret bar \
  --publish false \
  --subscribe false \
  --join false \
  --list false

atmoky Logo

© 2024 atmoky, GmbH.
All rights reserved.

We use cookies to measure and improve your browsing experience, and serve personalized ads or content.