Issue Description:
When attempting to join a channel, the app returns an error indicating that the token does not match the App ID. The developer confirms that they are copying the main certificate and App ID correctly, but the error still appears.
Platform/SDK:
Agora Web SDK (AgoraRTC)
Error Message:
AgoraRTCError CAN_NOT_GET_GATEWAY_SERVER: invalid vendor key, can not find appid
Step by Step Solution:
1. Verify the App ID:
- Log in to your Agora Console.
- Navigate to the Project Management page and confirm that the App ID in your code matches exactly with the App ID displayed in your project settings (including letter case and spacing).
2. Check Token Generation:
- If token authentication is enabled, confirm that you are generating tokens using the correct App ID and certificate associated with the same project.
- Ensure the following parameters used when creating the token align with your app’s join logic:
-
Channel name: Must match exactly with the one used in
join(). - User ID: Must be the same as the one passed when joining the channel.
- App ID and Certificate: Must belong to the same project.
3. Check the Token Delivery Endpoint:
- If tokens are generated on your own token server, verify that the app’s endpoint URL is configured correctly.
- Test the endpoint in a browser or with a tool like curl to confirm it returns a valid token.
4. Validate Token Format:
- Agora tokens typically start with 006 or 007. If your generated token does not follow this pattern, regenerate a valid token.
5. Retest the Join Process:
- After fixing the endpoint or regenerating a valid token, run your app again and attempt to join the channel. The error should no longer occur.
Root Cause:
This issue occurs when the App ID or token used by the client does not match the correct project credentials, or when the app fails to retrieve a token properly due to an incorrect token server endpoint.
Prevention/Best Practice:
- Always store and manage your App ID, App Certificate, and tokens securely.
- When using a token server, confirm endpoint URLs in your app configuration are correct after deployment or code changes.
- Test token generation regularly to ensure compatibility with your app’s authentication logic.
Corresponding Document/Link:
- Agora Token Overview
- Generate an Agora Token