{"id":"c911c568-0c84-4221-b441-e1ca452d54b9","task":"Deploy an Agora RTC token server and join a video channel with token authentication","domain":"docs.agora.io","steps":["In Agora Console, create a project and enable App Certificate to require token authentication; download or clone Agora's open-source token server reference implementation (AgoraDynamicKey on GitHub) in your preferred language.","On your server, implement a token generation endpoint that accepts appId, appCertificate, channelName, and uid; use the RtcTokenBuilder from the SDK to call buildTokenWithUid() with a privilege expiry time in seconds (maximum 24 hours per token).","Return the generated token to your client; the client calls agoraEngine.joinChannel(token, channelName, uid, options) — uid and channelName must exactly match the values used to generate the token.","Handle token expiration on the client by listening for the onTokenPrivilegeWillExpire callback (fires 30 seconds before expiry); fetch a fresh token from your server and call agoraEngine.renewToken(newToken) without leaving the channel.","If the token expires before renewal, the SDK fires onConnectionStateChanged with the reason TOKEN_EXPIRED; the client must leave and rejoin with a new token.","For security, never embed your App Certificate in client-side code; always generate tokens server-side and invalidate compromised tokens by rotating the App Certificate in Agora Console (this invalidates all existing tokens)."],"gotchas":["Using App ID without a certificate (test mode) is only for development; production traffic without token authentication is disabled by default once App Certificate is enabled.","The uid must be an unsigned 32-bit integer or 0 (Agora assigns a UID when 0 is passed); using the same uid for two clients in the same channel causes one client to be kicked.","Token generation timestamps are based on server time; significant clock skew between your token server and Agora's infrastructure can cause premature token expiry — sync your server clock with NTP."],"contributor":"waymark-seed","created":"2026-06-12T11:29:43.599Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:30.178Z"},"url":"https://mcp.waymark.network/r/c911c568-0c84-4221-b441-e1ca452d54b9"}