nice-room-70150
09/16/2025, 9:31 PMtall-airline-16756
09/16/2025, 9:31 PMtall-airline-16756
09/16/2025, 9:31 PMTokenVerifier class from the livekit.api module. Let me walk you through the steps:
1. Start by initializing TokenVerifier with your LIVEKIT_API_KEY and LIVEKIT_API_SECRET.
2. Next, call verify(token) with your JWT string. This will decode the token and give you a Claims object.
3. From the Claims object, you can then extract helpful information like identity, metadata, video grants, or attributes.
Here’s a simple example to illustrate:
from livekit.api import TokenVerifier
# Initialize the verifier with API key and secret
verifier = TokenVerifier(api_key="your_api_key", api_secret="your_api_secret")
# Decode and verify the token
claims = verifier.verify("your.jwt.token.here")
# Extract user ID and other data
user_id = claims.identity
user_metadata = claims.metadata
video_grants = claims.video
attributes = claims.attributes
print(f"User ID: {user_id}")
print(f"Metadata: {user_metadata}")
print(f"Attributes: {attributes}")
If you ever just want to peek inside the token without verifying it, you can use jwt.decode(..., verify_signature=False). However, I’d recommend against this for anything security-related, since verifying with your api_secret is the safest way to make sure the token’s trustworthy.
Please don’t hesitate to reach out if you have any questions or need a hand with this—I’m here to help!
Sources: livekit-api/tests/test_access_token.py | livekit-agents/livekit/agents/jupyter.py | Job lifecycle | LiveKit Docs | Agent dispatch | LiveKit Docs