astonishing-horse-62951
10/04/2025, 5:13 AMtall-airline-16756
10/04/2025, 5:13 AMtall-airline-16756
10/04/2025, 5:13 AMastonishing-horse-62951
10/04/2025, 5:16 AMtall-airline-16756
10/04/2025, 5:16 AM<LiveKitRoom
serverUrl="wss://your-livekit-server"
token="your-jwt-access-token"
connectOptions={{ autoSubscribe: true }}
onConnected={() => { console.log("Connected to room"); }}
>
{/* Child components */}
</LiveKitRoom>
Make sure your token includes the right grants, like room join, publish, and subscribe, tailored to the participant’s role. You’ll want to get this token from your backend authentication system before rendering the LiveKitRoom component. If you have any questions along the way, feel free to ask—I’m here to help! Sources: Authentication | LiveKit Docs | README.md | packages/react/src/components/LiveKitRoom.tsxastonishing-horse-62951
10/04/2025, 5:20 AMtall-airline-16756
10/04/2025, 5:21 AMmetadata field. Here’s a simple example in Node.js:
import { AccessToken } from 'livekit-server-sdk';
const at = new AccessToken('api-key', 'api-secret', {
identity: 'user123',
metadata: JSON.stringify({
supabaseToken: 'your-supabase-jwt',
// other custom data
}),
});
at.addGrant({ room: 'my-room', roomJoin: true, canPublish: true, canSubscribe: true });
const token = await at.toJwt();
You’ll then send this token to the client, where it’s used in the LiveKitRoom component.
2. Access Metadata on the Client
Once connected, you can grab the metadata from the participant object in your React app like this:
import { useParticipantContext } from '@livekit/components-react';
const ParticipantInfo = () => {
const participant = useParticipantContext();
const metadata = participant.metadata; // This includes your Supabase JWT
return <div>Metadata: {metadata}</div>;
};
Important Notes:
• Keep in mind metadata is limited to 64 KiB.
• Make sure to handle token expiration and revocation properly for security.
This method helps ensure your Supabase JWT is passed securely and is ready to be used for your tool’s functionality. If you have any questions or need further help, feel free to ask! Sources: examples/nextjs/pages/processors.tsx | docs/interfaces/LiveKitRoomProps.html | web/src/app/api/token/route.ts | Room metadata | LiveKit Docs | Authentication | LiveKit Docsastonishing-horse-62951
10/05/2025, 9:37 PMtall-airline-16756
10/05/2025, 9:37 PM