CreateParticipantTokenCommand

Creates an additional token for a specified stage. This can be done after stage creation or when tokens expire. Tokens always are scoped to the stage for which they are created.

Encryption keys are owned by Amazon IVS and never used directly by your application.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { IVSRealTimeClient, CreateParticipantTokenCommand } from "@aws-sdk/client-ivs-realtime"; // ES Modules import
// const { IVSRealTimeClient, CreateParticipantTokenCommand } = require("@aws-sdk/client-ivs-realtime"); // CommonJS import
const client = new IVSRealTimeClient(config);
const input = { // CreateParticipantTokenRequest
  stageArn: "STRING_VALUE", // required
  duration: Number("int"),
  userId: "STRING_VALUE",
  attributes: { // ParticipantTokenAttributes
    "<keys>": "STRING_VALUE",
  },
  capabilities: [ // ParticipantTokenCapabilities
    "STRING_VALUE",
  ],
};
const command = new CreateParticipantTokenCommand(input);
const response = await client.send(command);
// { // CreateParticipantTokenResponse
//   participantToken: { // ParticipantToken
//     participantId: "STRING_VALUE",
//     token: "STRING_VALUE",
//     userId: "STRING_VALUE",
//     attributes: { // ParticipantTokenAttributes
//       "<keys>": "STRING_VALUE",
//     },
//     duration: Number("int"),
//     capabilities: [ // ParticipantTokenCapabilities
//       "STRING_VALUE",
//     ],
//     expirationTime: new Date("TIMESTAMP"),
//   },
// };

CreateParticipantTokenCommand Input

Parameter
Type
Description
stageArn
Required
string | undefined

ARN of the stage to which this token is scoped.

attributes
Record<string, string> | undefined

Application-provided attributes to encode into the token and attach to a stage. Map keys and values can contain UTF-8 encoded text. The maximum length of this field is 1 KB total. This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.

capabilities
ParticipantTokenCapability[] | undefined

Set of capabilities that the user is allowed to perform in the stage. Default: PUBLISH, SUBSCRIBE.

duration
number | undefined

Duration (in minutes), after which the token expires. Default: 720 (12 hours).

userId
string | undefined

Name that can be specified to help identify the token. This can be any UTF-8 encoded text. This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.

CreateParticipantTokenCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
participantToken
ParticipantToken | undefined

The participant token that was created.

Throws

Name
Fault
Details
AccessDeniedException
client
<p/>
PendingVerification
client
<p/>
ResourceNotFoundException
client
<p/>
ServiceQuotaExceededException
client
<p/>
ValidationException
client
<p/>
IVSRealTimeServiceException
Base exception class for all service exceptions from IVSRealTime service.