big-microphone-99982
11/06/2025, 5:32 AMtall-airline-16756
11/06/2025, 5:32 AMtall-airline-16756
11/06/2025, 5:32 AMWSServerHandshakeError 401 usually happens when the access token isn’t quite right. When you’re working in dev mode, LiveKit uses the default API key devkey and secret secret. To get things going smoothly, make sure you generate a valid token with these credentials. Here’s an example to guide you:
lk token create \
--api-key devkey --api-secret secret \
--join --room my-room --identity user1 \
--valid-for 24h
Once you have your token, include it in the WebSocket connection request under the Authorization: Bearer JWT header. Also, double-check that your LiveKit server is running with livekit-server --dev.
Some common reasons this error pops up are:
• Using the wrong API key or secret
• Token has expired
• The JWT token is malformed
• Missing or incorrect Authorization header
If you’d like, I’m here to help you troubleshoot further—just let me know!
Sources: Core Platform Architecture & Authentication | livekit/livekit_composite | D... | README.md | Running LiveKit locally | LiveKit Docs