You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: livekit-api/README.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,3 +4,26 @@ Access LiveKit server APIs and generate access tokens.
4
4
5
5
See https://docs.livekit.io/reference/server/server-apis for more information.
6
6
7
+
## Authentication
8
+
9
+
Every request to the server APIs is authenticated. `LiveKitAPI` supports two modes:
10
+
11
+
-**API key & secret** — recommended for backend use. The SDK signs a short-lived token per request from your key and secret. Keep your API secret on the server; never ship it to a client.
12
+
-**Access token** — for client-side use where the API secret must not be exposed. Pass a pre-signed [access token](https://docs.livekit.io/home/get-started/authentication/) that already carries the grants for the operations you'll perform; the SDK sends it verbatim.
13
+
14
+
```python
15
+
from livekit import api
16
+
17
+
# API key & secret: set LIVEKIT_URL, LIVEKIT_API_KEY, and LIVEKIT_API_SECRET,
18
+
# then construct with no arguments...
19
+
lkapi = api.LiveKitAPI()
20
+
21
+
# ...or pass any of them explicitly to override the corresponding env var:
The url and credentials fall back to the `LIVEKIT_URL`, `LIVEKIT_API_KEY`, `LIVEKIT_API_SECRET`, and `LIVEKIT_TOKEN` environment variables. Values you pass explicitly take precedence; the environment variables are used only as a fallback for arguments you omit — an ambient `LIVEKIT_TOKEN`, for example, won't override an explicitly-provided API key and secret.
0 commit comments