From 2158b7ed09813fb102e46b87aea4f1f2e71b8714 Mon Sep 17 00:00:00 2001 From: Max Heimbrock <43608204+MaxHeimbrock@users.noreply.github.com> Date: Mon, 10 Aug 2026 14:03:56 +0200 Subject: [PATCH] Renaming to development token source --- token_source/CMakeLists.txt | 10 ++++---- token_source/README.md | 25 +++++++++---------- token_source/token_source_caching.cpp | 2 +- ...ndbox.cpp => token_source_development.cpp} | 24 +++++++++--------- 4 files changed, 30 insertions(+), 31 deletions(-) rename token_source/{token_source_sandbox.cpp => token_source_development.cpp} (75%) diff --git a/token_source/CMakeLists.txt b/token_source/CMakeLists.txt index 098426a..175e6a1 100644 --- a/token_source/CMakeLists.txt +++ b/token_source/CMakeLists.txt @@ -20,11 +20,11 @@ get_filename_component(_lk_cmake_dir "${LiveKit_DIR}" DIRECTORY) # .../lib/cmak get_filename_component(_lk_lib_dir "${_lk_cmake_dir}" DIRECTORY) # .../lib set(_token_source_examples - token_source_literal token_source_literal.cpp - token_source_endpoint token_source_endpoint.cpp - token_source_sandbox token_source_sandbox.cpp - token_source_custom token_source_custom.cpp - token_source_caching token_source_caching.cpp + token_source_literal token_source_literal.cpp + token_source_endpoint token_source_endpoint.cpp + token_source_development token_source_development.cpp + token_source_custom token_source_custom.cpp + token_source_caching token_source_caching.cpp ) list(LENGTH _token_source_examples _count) diff --git a/token_source/README.md b/token_source/README.md index 932868a..a57a311 100644 --- a/token_source/README.md +++ b/token_source/README.md @@ -18,9 +18,9 @@ disconnects. | --- | --- | --- | | `LiteralTokenSource` | `token_source_literal.cpp` | You already have a URL + JWT (minted out of band, e.g. `lk token create`). The SDK consumes them as-is. | | `EndpointTokenSource` | `token_source_endpoint.cpp` | Recommended for production. The SDK POSTs request options to your backend token endpoint, which returns the URL + a fresh JWT. API keys stay server-side. | -| `SandboxTokenSource` | `token_source_sandbox.cpp` | Local development only. Uses LiveKit Cloud's sandbox token server. **Not for production.** | +| `DevelopmentTokenSource` | `token_source_development.cpp` | Local development only. Uses LiveKit Cloud's development token server. **Not for production.** | | `CustomTokenSource` | `token_source_custom.cpp` | You have an internal auth/token system. Plug in your own async callback that returns credentials. | -| `CachingTokenSource` | `token_source_caching.cpp` | A decorator that adds JWT-aware caching around any configurable source (endpoint/sandbox/custom) to cut down on fetch calls. | +| `CachingTokenSource` | `token_source_caching.cpp` | A decorator that adds JWT-aware caching around any configurable source (endpoint/development/custom) to cut down on fetch calls. | `LiteralTokenSource` is *fixed* (no per-call options); the others are *configurable* and accept @@ -29,7 +29,7 @@ disconnects. ## Configuring the Examples -All inputs come from environment variables, so no secrets or sandbox IDs are committed to source. +All inputs come from environment variables, so no secrets or token server IDs are committed to source. | Variable | Used by | Notes | | --- | --- | --- | @@ -38,9 +38,9 @@ All inputs come from environment variables, so no secrets or sandbox IDs are com | `LIVEKIT_TOKEN_ENDPOINT` | endpoint, caching | Token endpoint URL. Default `http://127.0.0.1:3000/createToken`. | | `LIVEKIT_TOKEN_ENDPOINT_METHOD` | endpoint, caching | Optional HTTP method (default `POST`). | | `LIVEKIT_TOKEN_ENDPOINT_HEADERS` | endpoint, caching | Optional newline-separated `Name: Value` headers. | -| `LIVEKIT_SANDBOX_ID` | sandbox | Required. Sandbox ID from LiveKit Cloud. | -| `LIVEKIT_AGENT_NAME` | sandbox | Optional agent to dispatch into the room. | -| `LIVEKIT_AGENT_METADATA` | sandbox | Optional metadata for the dispatched agent. | +| `LIVEKIT_TOKEN_SERVER_ID` | development | Required. Development token server ID from LiveKit Cloud. | +| `LIVEKIT_AGENT_NAME` | development | Optional agent to dispatch into the room. | +| `LIVEKIT_AGENT_METADATA` | development | Optional metadata for the dispatched agent. | These examples require LiveKit C++ SDK **v1.3.0** or newer. Build them with the rest of the repo — see the root [README](../README.md#building-the-examples). @@ -78,14 +78,13 @@ cd /token-server-node LIVEKIT_URL=ws://localhost:7880 LIVEKIT_API_KEY=devkey LIVEKIT_API_SECRET=secret PORT=3000 pnpm start ``` -For sandbox, create a **Token Server** sandbox in [LiveKit Cloud](https://cloud.livekit.io) -(Sandbox → create from the token-server template), then copy the sandbox ID +For development, enable the **Development Token Server** in [LiveKit Cloud](https://cloud.livekit.io), then copy the token server ID (`token-server-xxxxxx`). See the -[sandbox token server docs](https://docs.livekit.io/frontends/build/authentication/sandbox-token-server/) +[development token server docs](https://docs.livekit.io/frontends/build/authentication/sandbox-token-server/) for setup details. Do not use this in production. ```bash -export LIVEKIT_SANDBOX_ID=token-server-xxxxxx +export LIVEKIT_TOKEN_SERVER_ID=token-server-xxxxxx # optional: dispatch a registered agent into the room with metadata # export LIVEKIT_AGENT_NAME=my-agent # export LIVEKIT_AGENT_METADATA='{"greeting": "hello from cpp"}' @@ -110,11 +109,11 @@ export LIVEKIT_TOKEN_ENDPOINT=http://127.0.0.1:3000/createToken ``` ```bash -# Sandbox: development-only, ID from the environment -export LIVEKIT_SANDBOX_ID= +# Development: development-only, ID from the environment +export LIVEKIT_TOKEN_SERVER_ID= export LIVEKIT_AGENT_NAME= # optional export LIVEKIT_AGENT_METADATA= # optional -./build/token_source/token_source_sandbox +./build/token_source/token_source_development ``` ```bash diff --git a/token_source/token_source_caching.cpp b/token_source/token_source_caching.cpp index 30ceb3b..ad78af1 100644 --- a/token_source/token_source_caching.cpp +++ b/token_source/token_source_caching.cpp @@ -15,7 +15,7 @@ */ // Caching token source: a decorator that adds JWT-aware caching to any -// configurable token source (endpoint, sandbox, or custom). +// configurable token source (endpoint, development, or custom). // // Repeated fetches for the same request options reuse the cached token until it // nears expiry or you call invalidate() to drop the cached credentials, cutting diff --git a/token_source/token_source_sandbox.cpp b/token_source/token_source_development.cpp similarity index 75% rename from token_source/token_source_sandbox.cpp rename to token_source/token_source_development.cpp index 4fb0445..007491c 100644 --- a/token_source/token_source_sandbox.cpp +++ b/token_source/token_source_development.cpp @@ -14,14 +14,14 @@ * limitations under the License. */ -// Sandbox token source: use LiveKit Cloud's sandbox token server for quick +// Development token source: use LiveKit Cloud's development token server for quick // local development. Do not use in production. // -// The sandbox ID is read from the environment (never hard-coded) so this -// example does not link a personal sandbox into source control. +// The token server ID is read from the environment (never hard-coded) so this +// example does not link a personal token server ID into source control. // // Environment: -// LIVEKIT_SANDBOX_ID Sandbox identifier from LiveKit Cloud (required) +// LIVEKIT_TOKEN_SERVER_ID Token server identifier from LiveKit Cloud (required) // LIVEKIT_AGENT_NAME Optional registered agent to dispatch into the room // LIVEKIT_AGENT_METADATA Optional metadata passed to the dispatched agent @@ -37,15 +37,15 @@ namespace { using namespace token_source_example; -bool sandboxTokenSourceConnect() { - std::string sandbox_id; - if (!requireEnv("LIVEKIT_SANDBOX_ID", sandbox_id)) { +bool DevelopmentTokenSourceConnect() { + std::string token_server_id; + if (!requireEnv("LIVEKIT_TOKEN_SERVER_ID", token_server_id)) { return false; } // POSTs to cloud-api.livekit.io/api/v2/sandbox/connection-details with - // X-Sandbox-ID set from LIVEKIT_SANDBOX_ID. - auto token_source = livekit::SandboxTokenSource::create(sandbox_id); + // X-Sandbox-ID set from LIVEKIT_TOKEN_SERVER_ID. + auto token_source = livekit::DevelopmentTokenSource::create(token_server_id); livekit::TokenRequestOptions request_options; request_options.participant_identity = "robot-a"; @@ -57,7 +57,7 @@ bool sandboxTokenSourceConnect() { if (const std::string agent_metadata = getenvOrEmpty("LIVEKIT_AGENT_METADATA"); !agent_metadata.empty()) { request_options.agent_metadata = agent_metadata; } - std::cout << "Requesting sandbox token with agent dispatch: agent_name=" << *request_options.agent_name << "\n"; + std::cout << "Requesting development token with agent dispatch: agent_name=" << *request_options.agent_name << "\n"; } const auto credentials = token_source->fetch(request_options).get(); if (!credentials) { @@ -72,7 +72,7 @@ bool sandboxTokenSourceConnect() { std::cerr << "Failed to connect to room\n"; return false; } - std::cout << "Connected to room: " << room.roomInfo().name << " (sandbox token source)\n"; + std::cout << "Connected to room: " << room.roomInfo().name << " (development token source)\n"; return runConnectedSession(room); } @@ -81,7 +81,7 @@ bool sandboxTokenSourceConnect() { int main() { livekit::initialize(livekit::LogLevel::Info); - const bool ok = sandboxTokenSourceConnect(); + const bool ok = DevelopmentTokenSourceConnect(); livekit::shutdown(); return ok ? 0 : 1; }