Issue Description:
Users attempting to implement real-time video and chat integration using Agora SDKs are encountering issues with expired tokens during video calls and invalid user ID errors for real-time chat logins. Tokens are generated but fail to work due to errors associated with channel name length and matching issues.
Platform/SDK:
Agora SDKs for video (RTC) and real-time messaging (RTM) integration on a ReactJS platform.
Error Message:
- RTC: Tokens are reported as expired immediately upon validation.
- RTM: Error - Invalid user ID: "illegal symbol or too long," as well as service not enabled/stopped errors.
Step by Step Solution:
1. Token Generation Adjustments for RTC:
- Review your token generation logic to ensure that expiration is set correctly.
- Utilize the example provided by Agora for generating tokens without appending the current timestamp to the expiration time.
- Ensure commas and variable names are correctly specified in your code.
- Verify that the generated token does not have extra characters like spaces.
2. RTM Login Adjustments:
- Ensure that the user ID (UID) for RTM is alphanumeric, includes underscores only, and does not exceed 64 characters.
- Ensure the Agora Console has Signaling/RTM enabled, and a data center selected.
- Standardize different UIDs for RTC and RTM as required by Agora's protocols.
3. Channel Name Adjustments:
- Ensure the channel name does not exceed 26 characters.
- Use a simplified naming convention, such as private_room1, to prevent exceeding character limits and maintaining naming convention standards.
Root Cause:
Issues were caused by improper configuration settings, such as incorrect token generation logic, invalid characters or excessive length in user IDs and channel names, and unconfigured RTM authorization settings in the Agora console.
Prevention/Best Practice:
- Thoroughly check your code and configuration for adherence to document recommendations, including validation of token logic and naming conventions.
- When managing UIDs and channel names, ensure they follow character limits and utilize supported characters and formats.
- Always confirm console settings for required services like RTM before attempting integration.
Corresponding Document/Link (optional):
- Agora Documentation for Channel Name Legal Characters