Why you need it
When a user wants to join a video conference or send a chat message, the client SDK needs to authenticate against Red5 Cloud. If you hardcode master credentials in your app, anyone who decompiles or inspects your client can extract them. Instead, your backend uses the Backend SDK to mint a signed token scoped to a specific user, room, and role — the token carries only the minimum permissions needed, and it expires after a configurable time window.Your master key and secret are available on the Dev Resources page in the Red5 Cloud dashboard. Store them as environment variables on your server and never commit them to source control.
Token types
Conference token — authorizes a user to join a specific video room with a given role (admin, publisher, or subscriber). Pass this token to client.join() in the Conference SDK, or to the setToken() method in the iOS or Android SDK.
Chat token — authorizes a user to read and/or write on a specific PubNub channel. Pass this token to setChatToken() on the iOS or Android SDK client.
Installation
- Node.js
- Java
- Go
The
red5-bcs-node package is not yet published to the npm registry. Contact Red5 support to obtain the package.Conference token generation
- Node.js
- Java
- Go
Chat token generation
- Node.js
- Java
- Go
Roles
Full example
The following shows a complete server handler that issues both a conference token and a chat token for a single user request.- Node.js
- Java
- Go
Using tokens with client SDKs
Once your backend issues a token, pass it to the appropriate client SDK method:- Conference SDK — pass as the
tokenargument toclient.join() - iOS SDK — pass to
.setToken()or.setAuthToken()onRed5WebrtcClientBuilder - Android SDK — pass to
.setToken()onIRed5WebrtcClient.builder() - Chat (iOS) — pass to
.setPubnubAuthKey()onRed5WebrtcClientBuilder - Chat (Android) — pass to
.setChatToken()onIRed5WebrtcClient.builder()
Security best practices
- Store master credentials as environment variables, not in source code
- Use HTTPS for all token delivery endpoints
- Keep token lifetimes short — 30 to 60 minutes is a reasonable default
- Validate the requesting user’s identity on your backend before issuing a token
- Use the minimum role required (
subscriberinstead ofpublisherfor view-only users)
