LiveKit C++ Client SDK v1.4.0
Real-time audio/video/data SDK for C++
Loading...
Searching...
No Matches
livekit::CustomTokenSource Class Referencefinal

Token source that delegates token generation to your callback. More...

#include <token_source.h>

Inheritance diagram for livekit::CustomTokenSource:
Collaboration diagram for livekit::CustomTokenSource:

Public Member Functions

std::future< Result< TokenSourceResponse, TokenSourceError > > fetch (const TokenRequestOptions &options={}) override
 

Static Public Member Functions

static std::unique_ptr< CustomTokenSourcecreate (std::function< std::future< Result< TokenSourceResponse, TokenSourceError > >(const TokenRequestOptions &)> provider)
 Create a token source that delegates fetching to provider.
 

Detailed Description

Token source that delegates token generation to your callback.

Choose this when you already have an internal auth/token system and want to integrate it with LiveKit's request options without adopting the standardized token endpoint format.

Member Function Documentation

◆ create()

static std::unique_ptr< CustomTokenSource > livekit::CustomTokenSource::create ( std::function< std::future< Result< TokenSourceResponse, TokenSourceError > >(const TokenRequestOptions &)>  provider)
static

Create a token source that delegates fetching to provider.

The callback receives TokenRequestOptions for each fetch and returns TokenSourceResponse produced by your application.

Parameters
providerAsync provider called for each fetch.
Returns
A configurable token source backed by provider.

◆ fetch()

std::future< Result< TokenSourceResponse, TokenSourceError > > livekit::CustomTokenSource::fetch ( const TokenRequestOptions options = {})
overridevirtual
Note
This source holds no cache and invokes the provider fresh on every call. Wrap it in CachingTokenSource to reuse credentials.

Implements livekit::TokenSourceConfigurable.


The documentation for this class was generated from the following file: