Access tools

更新时间:
复制 MD 格式

This topic describes how to generate and validate tokens in the Real-Time Communication (RTC) console.

Scenarios

  • During the proof of concept (POC) stage, you can use the token generator to create a temporary token to quickly test your application.

  • Before your application is published, you can use the token validator to validate the token generated on the server-side. This helps you quickly locate issues and prevent problems, such as failures to join a channel.

Important

Tokens generated in the console are temporary and intended for testing. For production use, generate tokens on the server-side. For more information, see Token-based authentication.

Procedure

  1. Log on to the Real-Time Communication (RTC) console.

  2. In the navigation pane on the left, choose Access Tools.

  3. Optional: Generate a token.

    1. Click the Token Generator tab and enter the required parameters.

      Parameter

      Description

      AppID

      The application ID. You can create and view the ID on the Application Management page in the console. For more information, see Application Management.

      AppKey

      The AppKey of the application. On the Application Management page in the console, click the More button to query the AppKey.

      ChannelId

      The channel ID. It must be 1 to 64 characters in length and can contain uppercase letters, lowercase letters, digits, underscores (_), and hyphens (-).

      UserId

      The user ID. It must be 1 to 64 characters in length and can contain uppercase letters, lowercase letters, digits, underscores (_), and hyphens (-).

      TimeStamp

      The expiration timestamp. You can select 3 hours, 6 hours, 12 hours, or 24 hours. This represents the validity period of the token.

    2. Click Generate to view the token.

  4. Optional: Validate a token.

    1. Click the Token Validator tab and enter the required parameters.

      Parameter

      Description

      AppID

      The application ID. You can create and view the ID on the Application Management page in the console. For more information, see Application Management.

      AppKey

      The AppKey for the application. You can find it in the console under Application Management > More.

      ChannelId

      The channel ID. It must be 1 to 64 characters in length and can contain uppercase letters, lowercase letters, digits, underscores (_), and hyphens (-).

      UserId

      The user ID. It must be 1 to 64 characters in length and can contain uppercase letters, lowercase letters, digits, underscores (_), and hyphens (-).

      TimeStamp

      The expiration timestamp. For example, `1710210237` indicates that the token expires at 10:23:57 on 2024-03-12.

      Token

      The token used to join the channel. This token is generated by your AppServer.

    2. Click Validate.

      • The verification is complete. You can now join the channel to make a call.

      • If the validation fails, check the parameters and the token information from your AppServer.