Development tools

更新时间:
复制 MD 格式

You can generate and verify tokens in the Real-Time Communication (RTC) console. This topic describes how to generate and verify a token.

Scenarios

  • During proof of concept (POC), you can use the token generator to generate a temporary token that can be used to test your application.
  • Before your application is officially launched, you can use the token verifier to verify official tokens generated by the application server. This way, you can test the application and identify issues. Issues such as failure to join a channel can be effectively prevented.

Usage notes

Tokens that are generated by using the console are temporary, and are usually used for testing. If you want to obtain an official token, use the application server to generate one. For more information, see Generate a token on the application server.

Procedure

  1. Log on to the Real-Time Communication RTC console.
  2. In the left-side navigation pane, click Development Tools. The Development Tools page is displayed.
  3. Optional:Generate a token.
    1. Click the Token Generator tab and configure the required parameters.
      ParameterDescription
      AppIDThe application ID. You can create and view application IDs on the Applications page in the RTC console. For more information, see Applications.
      AppKeyThe application key. You can query application keys on the Applications page in the console. For more information, see Query AppKey.
      ChannelIdThe ID of the channel. The ID must be 1 to 64 characters in length and can contain letters, digits, underscores (_), and hyphens (-).
      UserIdThe ID of the user. The ID must be 1 to 64 characters in length and can contain letters, digits, underscores (_), and hyphens (-).
      NonceA random string. Nonces start with AK- and consist of letters and digits. Nonces can contain up to 64 characters. Example: AK-2b9be4b25c2d38c409c376ffd2372be1.
      TimeStampThe timestamp that indicates when the token expires. You can select 12 hours, 24 hours, 3 days, or 7 days.
    2. Click Generate, and view the generated token.
      Generate a token
  4. Optional:Verify a token.
    1. Click the Token Verifier tab and configure the required parameters.
      ParameterDescription
      AppIDThe application ID. You can create and view application IDs on the Applications page in the RTC console. For more information, see Applications.
      AppKeyThe application key. You can query application keys on the Applications page in the console. For more information, see Query AppKey.
      ChannelIdThe ID of the channel. The ID must be 1 to 64 characters in length and can contain letters, digits, underscores (_), and hyphens (-).
      UserIdThe ID of the user. The ID must be 1 to 64 characters in length and can contain letters, digits, underscores (_), and hyphens (-).
      NonceA random string. Nonces are issued by the application server. Nonces start with AK- and consist of letters and digits. Nonces can contain up to 64 characters. Example: AK-2b9be4b25c2d38c409c376ffd2372be1.
      TimeStampThe timestamp that indicates when the token expires. For example, 1560588594 indicates that the token expires at 16:49:54, June 15, 2019.
      TokenThe token that is used to join the channel. The token is generated by the application server.
    2. Click Verify.
      • If the verification is successful, you can join the channel to make a call.
      • If the verification fails, check the parameters and the token issued by the application server.