EndpointTokenSource class

A token source that fetches credentials via HTTP requests from a custom backend.

This implementation:

  • Sends a POST request to the specified URL (configurable via method)
  • Encodes the request parameters as TokenRequestOptions JSON in the request body
  • Includes any custom headers specified via headers
  • Expects the response to be decoded as TokenSourceResponse JSON
  • Validates HTTP status codes (200-299) and throws appropriate errors for failures
Implemented types
Implementers
Available extensions

Constructors

EndpointTokenSource({required Uri url, String method = 'POST', Map<String, String> headers = const {}, Client? client})
Initialize with endpoint configuration.

Properties

client Client?
Optional HTTP client for testing purposes.
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
Additional HTTP headers to include with the request.
final
method String
The HTTP method to use for the token request (defaults to "POST").
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uri Uri
The URL endpoint for token generation. This should point to your backend service that generates LiveKit tokens.
final

Methods

cached({TokenStore? store, TokenValidator? validator}) CachingTokenSource

Available on TokenSourceConfigurable, provided by the CachedTokenSource extension

Wraps this token source with caching capabilities.
fetch(TokenRequestOptions options) Future<TokenSourceResponse>
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited