Class LiveKitTokenVerifier
- Namespace
- LiveKit.Authentication
- Assembly
- LiveKit.AspNetCore.ServerSdk.dll
public sealed class LiveKitTokenVerifier : ILiveKitTokenVerifier
- Inheritance
-
LiveKitTokenVerifier
- Implements
- Inherited Members
Constructors
LiveKitTokenVerifier(IOptions<LiveKitOptions>)
Initializes a new instance of the LiveKitTokenVerifier class.
public LiveKitTokenVerifier(IOptions<LiveKitOptions> options)
Parameters
optionsIOptions<LiveKitOptions>The LiveKit configuration options.
Exceptions
- ArgumentNullException
Thrown when options is null.
- InvalidOperationException
Thrown when API key or secret is not configured.
Methods
VerifyAsync(string, TimeSpan?, CancellationToken)
Verifies a LiveKit JWT token and extracts its claims.
Validation includes: - Signature verification using the API secret - Issuer (API key) validation - Expiration time check with configurable clock tolerance
public Task<IDictionary<string, string>> VerifyAsync(string token, TimeSpan? clockTolerance = null, CancellationToken cancellationToken = default)
Parameters
tokenstringThe JWT token to verify.
clockToleranceTimeSpan?Optional clock tolerance for expiration validation. If not specified, uses the configured webhook clock tolerance.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IDictionary<string, string>>
A dictionary of claims extracted from the token, with claim names as keys.
Exceptions
- ArgumentException
Thrown when the token is null or empty.
- Exception
Thrown when token validation fails (e.g. SecurityTokenExpiredException, SecurityTokenInvalidSignatureException).