freezing-receptionist-32972
10/24/2025, 4:52 AMtall-airline-16756
10/24/2025, 4:52 AMtall-airline-16756
10/24/2025, 4:52 AMconst at = new AccessToken('api-key', 'secret-key', {
identity: 'user-name',
});
at.addGrant({
roomJoin: true,
room: 'my-room',
canPublish: false, // Cannot publish
canSubscribe: true, // Can subscribe
canPublishData: true,
});
const token = await at.toJwt();
Also, a quick but important tip: make sure to keep your API keys safe by storing them in environment variables and never expose them in client-side code. If you ever suspect a key has been compromised, rotating and revoking them is a great way to stay secure. Using short-lived tokens can also help minimize any risks.
If you’d like to dive deeper, here’s a handy Token Creation and Permissions Guide that walks through everything in detail.
Sources: LiveKit | LiveKit Security | Mini tutorial: setting up a LiveKit Cloud project | Testing and evaluation | LiveKit Docs | CLI Tools & Token Management | livekit/livekit_composite | DeepWikifreezing-receptionist-32972
10/24/2025, 4:58 AMtall-airline-16756
10/24/2025, 4:59 AM