POST /authentication/jwt
Generate a JWT (JSON Web Token) for secure frontend WebSocket connections. JWTs allow your client-side code to connect without exposing your API key.
Security model: Generate JWTs server-side using your API key, then pass the jwtKey to your frontend. The JWT can be scoped to specific creators (allowed_creators) and limited to a set number of concurrent connections.
Expiry: Tokens expire after expire_after seconds (default: 3600 = 1 hour). After expiry, the client must request a new token from your backend.
Use cases: Web applications where the frontend connects directly to wss://api.tik.tools?uniqueId=USERNAME&jwtKey=TOKEN. This keeps your API key on the server while letting browsers connect to the WebSocket.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
expire_after | number | No | Seconds until expiry (default: 3600) |
allowed_creators | string[] | No | Restrict to specific creators |
max_websockets | number | No | Max concurrent WS connections (default: 1) |