Two calls: one from your server to mint a token, one from your client to join the room.
Call this every time a real user needs to join a room — one token per participant, never share one.
curl -X POST https://livekit.yourdomain.com/token \
-H "Authorization: Bearer <your-app-id>.<your-secret>" \
-H "Content-Type: application/json" \
-d '{
"roomName": "room-1",
"identity": "user-42",
"name": "Jane Doe"
}'
Response:
{ "success": true, "token": "<jwt>", "wsUrl": "wss://your-livekit-server" }
npm install livekit-client
import { Room } from 'livekit-client';
const room = new Room();
await room.connect(wsUrl, token);
// Publish your camera/mic
await room.localParticipant.setCameraEnabled(true);
await room.localParticipant.setMicrophoneEnabled(true);
// Render remote participants
room.on('trackSubscribed', (track, publication, participant) => {
const el = track.attach();
document.body.appendChild(el);
});
Same pattern everywhere — mint a token from your backend, connect with the platform SDK:
React Native npm install @livekit/react-native
iOS (Swift) https://github.com/livekit/client-sdk-swift
Android https://github.com/livekit/client-sdk-android
Flutter flutter pub add livekit_client
Unity https://github.com/livekit/client-sdk-unity
The request body accepts:
{
"roomName": "string, required — the room to join",
"identity": "string, required — unique ID for this participant",
"name": "string, optional — display name (defaults to identity)",
"canPublish": "boolean, optional — defaults to true",
"canSubscribe": "boolean, optional — defaults to true"
}