Skip to content

Commit 2158b7e

Browse files
committed
Renaming to development token source
1 parent 7e76bea commit 2158b7e

4 files changed

Lines changed: 30 additions & 31 deletions

File tree

‎token_source/CMakeLists.txt‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ get_filename_component(_lk_cmake_dir "${LiveKit_DIR}" DIRECTORY) # .../lib/cmak
2020
get_filename_component(_lk_lib_dir "${_lk_cmake_dir}" DIRECTORY) # .../lib
2121

2222
set(_token_source_examples
23-
token_source_literal token_source_literal.cpp
24-
token_source_endpoint token_source_endpoint.cpp
25-
token_source_sandbox token_source_sandbox.cpp
26-
token_source_custom token_source_custom.cpp
27-
token_source_caching token_source_caching.cpp
23+
token_source_literal token_source_literal.cpp
24+
token_source_endpoint token_source_endpoint.cpp
25+
token_source_development token_source_development.cpp
26+
token_source_custom token_source_custom.cpp
27+
token_source_caching token_source_caching.cpp
2828
)
2929

3030
list(LENGTH _token_source_examples _count)

‎token_source/README.md‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ disconnects.
1818
| --- | --- | --- |
1919
| `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. |
2020
| `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. |
21-
| `SandboxTokenSource` | `token_source_sandbox.cpp` | Local development only. Uses LiveKit Cloud's sandbox token server. **Not for production.** |
21+
| `DevelopmentTokenSource` | `token_source_development.cpp` | Local development only. Uses LiveKit Cloud's development token server. **Not for production.** |
2222
| `CustomTokenSource` | `token_source_custom.cpp` | You have an internal auth/token system. Plug in your own async callback that returns credentials. |
23-
| `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. |
23+
| `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. |
2424

2525
`LiteralTokenSource` is *fixed* (no per-call options); the others are
2626
*configurable* and accept
@@ -29,7 +29,7 @@ disconnects.
2929

3030
## Configuring the Examples
3131

32-
All inputs come from environment variables, so no secrets or sandbox IDs are committed to source.
32+
All inputs come from environment variables, so no secrets or token server IDs are committed to source.
3333

3434
| Variable | Used by | Notes |
3535
| --- | --- | --- |
@@ -38,9 +38,9 @@ All inputs come from environment variables, so no secrets or sandbox IDs are com
3838
| `LIVEKIT_TOKEN_ENDPOINT` | endpoint, caching | Token endpoint URL. Default `http://127.0.0.1:3000/createToken`. |
3939
| `LIVEKIT_TOKEN_ENDPOINT_METHOD` | endpoint, caching | Optional HTTP method (default `POST`). |
4040
| `LIVEKIT_TOKEN_ENDPOINT_HEADERS` | endpoint, caching | Optional newline-separated `Name: Value` headers. |
41-
| `LIVEKIT_SANDBOX_ID` | sandbox | Required. Sandbox ID from LiveKit Cloud. |
42-
| `LIVEKIT_AGENT_NAME` | sandbox | Optional agent to dispatch into the room. |
43-
| `LIVEKIT_AGENT_METADATA` | sandbox | Optional metadata for the dispatched agent. |
41+
| `LIVEKIT_TOKEN_SERVER_ID` | development | Required. Development token server ID from LiveKit Cloud. |
42+
| `LIVEKIT_AGENT_NAME` | development | Optional agent to dispatch into the room. |
43+
| `LIVEKIT_AGENT_METADATA` | development | Optional metadata for the dispatched agent. |
4444

4545
These examples require LiveKit C++ SDK **v1.3.0** or newer. Build them with the
4646
rest of the repo — see the root [README](../README.md#building-the-examples).
@@ -78,14 +78,13 @@ cd <path-to>/token-server-node
7878
LIVEKIT_URL=ws://localhost:7880 LIVEKIT_API_KEY=devkey LIVEKIT_API_SECRET=secret PORT=3000 pnpm start
7979
```
8080

81-
For sandbox, create a **Token Server** sandbox in [LiveKit Cloud](https://cloud.livekit.io)
82-
(Sandbox → create from the token-server template), then copy the sandbox ID
81+
For development, enable the **Development Token Server** in [LiveKit Cloud](https://cloud.livekit.io), then copy the token server ID
8382
(`token-server-xxxxxx`). See the
84-
[sandbox token server docs](https://docs.livekit.io/frontends/build/authentication/sandbox-token-server/)
83+
[development token server docs](https://docs.livekit.io/frontends/build/authentication/sandbox-token-server/)
8584
for setup details. Do not use this in production.
8685

8786
```bash
88-
export LIVEKIT_SANDBOX_ID=token-server-xxxxxx
87+
export LIVEKIT_TOKEN_SERVER_ID=token-server-xxxxxx
8988
# optional: dispatch a registered agent into the room with metadata
9089
# export LIVEKIT_AGENT_NAME=my-agent
9190
# export LIVEKIT_AGENT_METADATA='{"greeting": "hello from cpp"}'
@@ -110,11 +109,11 @@ export LIVEKIT_TOKEN_ENDPOINT=http://127.0.0.1:3000/createToken
110109
```
111110

112111
```bash
113-
# Sandbox: development-only, ID from the environment
114-
export LIVEKIT_SANDBOX_ID=<your-sandbox-id>
112+
# Development: development-only, ID from the environment
113+
export LIVEKIT_TOKEN_SERVER_ID=<your-token-server-id>
115114
export LIVEKIT_AGENT_NAME=<your-agent-name> # optional
116115
export LIVEKIT_AGENT_METADATA=<your-agent-metadata> # optional
117-
./build/token_source/token_source_sandbox
116+
./build/token_source/token_source_development
118117
```
119118

120119
```bash

‎token_source/token_source_caching.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
// Caching token source: a decorator that adds JWT-aware caching to any
18-
// configurable token source (endpoint, sandbox, or custom).
18+
// configurable token source (endpoint, development, or custom).
1919
//
2020
// Repeated fetches for the same request options reuse the cached token until it
2121
// nears expiry or you call invalidate() to drop the cached credentials, cutting
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
// Sandbox token source: use LiveKit Cloud's sandbox token server for quick
17+
// Development token source: use LiveKit Cloud's development token server for quick
1818
// local development. Do not use in production.
1919
//
20-
// The sandbox ID is read from the environment (never hard-coded) so this
21-
// example does not link a personal sandbox into source control.
20+
// The token server ID is read from the environment (never hard-coded) so this
21+
// example does not link a personal token server ID into source control.
2222
//
2323
// Environment:
24-
// LIVEKIT_SANDBOX_ID Sandbox identifier from LiveKit Cloud (required)
24+
// LIVEKIT_TOKEN_SERVER_ID Token server identifier from LiveKit Cloud (required)
2525
// LIVEKIT_AGENT_NAME Optional registered agent to dispatch into the room
2626
// LIVEKIT_AGENT_METADATA Optional metadata passed to the dispatched agent
2727

@@ -37,15 +37,15 @@ namespace {
3737

3838
using namespace token_source_example;
3939

40-
bool sandboxTokenSourceConnect() {
41-
std::string sandbox_id;
42-
if (!requireEnv("LIVEKIT_SANDBOX_ID", sandbox_id)) {
40+
bool DevelopmentTokenSourceConnect() {
41+
std::string token_server_id;
42+
if (!requireEnv("LIVEKIT_TOKEN_SERVER_ID", token_server_id)) {
4343
return false;
4444
}
4545

4646
// POSTs to cloud-api.livekit.io/api/v2/sandbox/connection-details with
47-
// X-Sandbox-ID set from LIVEKIT_SANDBOX_ID.
48-
auto token_source = livekit::SandboxTokenSource::create(sandbox_id);
47+
// X-Sandbox-ID set from LIVEKIT_TOKEN_SERVER_ID.
48+
auto token_source = livekit::DevelopmentTokenSource::create(token_server_id);
4949

5050
livekit::TokenRequestOptions request_options;
5151
request_options.participant_identity = "robot-a";
@@ -57,7 +57,7 @@ bool sandboxTokenSourceConnect() {
5757
if (const std::string agent_metadata = getenvOrEmpty("LIVEKIT_AGENT_METADATA"); !agent_metadata.empty()) {
5858
request_options.agent_metadata = agent_metadata;
5959
}
60-
std::cout << "Requesting sandbox token with agent dispatch: agent_name=" << *request_options.agent_name << "\n";
60+
std::cout << "Requesting development token with agent dispatch: agent_name=" << *request_options.agent_name << "\n";
6161
}
6262
const auto credentials = token_source->fetch(request_options).get();
6363
if (!credentials) {
@@ -72,7 +72,7 @@ bool sandboxTokenSourceConnect() {
7272
std::cerr << "Failed to connect to room\n";
7373
return false;
7474
}
75-
std::cout << "Connected to room: " << room.roomInfo().name << " (sandbox token source)\n";
75+
std::cout << "Connected to room: " << room.roomInfo().name << " (development token source)\n";
7676

7777
return runConnectedSession(room);
7878
}
@@ -81,7 +81,7 @@ bool sandboxTokenSourceConnect() {
8181

8282
int main() {
8383
livekit::initialize(livekit::LogLevel::Info);
84-
const bool ok = sandboxTokenSourceConnect();
84+
const bool ok = DevelopmentTokenSourceConnect();
8585
livekit::shutdown();
8686
return ok ? 0 : 1;
8787
}

0 commit comments

Comments
 (0)