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
- Log on to the Real-Time Communication RTC console.
- In the left-side navigation pane, click Development Tools. The Development Tools page is displayed.
- Optional:Generate a token.
- Click the Token Generator tab and configure the required parameters.
Parameter Description AppID The application ID. You can create and view application IDs on the Applications page in the RTC console. For more information, see Applications. AppKey The application key. You can query application keys on the Applications page in the console. For more information, see Query AppKey. ChannelId The ID of the channel. The ID must be 1 to 64 characters in length and can contain letters, digits, underscores (_), and hyphens (-). UserId The ID of the user. The ID must be 1 to 64 characters in length and can contain letters, digits, underscores (_), and hyphens (-). Nonce A random string. Nonces start with AK- and consist of letters and digits. Nonces can contain up to 64 characters. Example: AK-2b9be4b25c2d38c409c376ffd2372be1. TimeStamp The timestamp that indicates when the token expires. You can select 12 hours, 24 hours, 3 days, or 7 days. - Click Generate, and view the generated token.

- Click the Token Generator tab and configure the required parameters.
- Optional:Verify a token.
- Click the Token Verifier tab and configure the required parameters.
Parameter Description AppID The application ID. You can create and view application IDs on the Applications page in the RTC console. For more information, see Applications. AppKey The application key. You can query application keys on the Applications page in the console. For more information, see Query AppKey. ChannelId The ID of the channel. The ID must be 1 to 64 characters in length and can contain letters, digits, underscores (_), and hyphens (-). UserId The ID of the user. The ID must be 1 to 64 characters in length and can contain letters, digits, underscores (_), and hyphens (-). Nonce A 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. TimeStamp The timestamp that indicates when the token expires. For example, 1560588594 indicates that the token expires at 16:49:54, June 15, 2019. Token The token that is used to join the channel. The token is generated by the application server. - 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.
- Click the Token Verifier tab and configure the required parameters.
该文章对您有帮助吗?