Skip to content

Authentication

Authentication is required before a third-party client can receive events.

Message order

The client must send AUTH as the first JSON message after validating SERVER_HELLO.

SERVER_HELLO

Direction: server to client.

Sent immediately after WebSocket connection.

FieldTypeRequiredDescription
typestringYesAlways SERVER_HELLO
productstringYesAlways tiktok_live_studio
channelstringYesAlways third-party-im
versionstringYesServer protocol version
json
{
  "type": "SERVER_HELLO",
  "product": "tiktok_live_studio",
  "channel": "third-party-im",
  "version": "1.0.0"
}

AUTH

Direction: client to server.

Must be the first client JSON message.

FieldTypeRequiredDescription
typestringYesAlways AUTH
app_idstringYesIssued application identifier
key_idstringYesIssued key version identifier
secretstringYesRaw application secret
versionstringNoClient protocol version
json
{
  "type": "AUTH",
  "app_id": "your_app_id",
  "key_id": "your_key_id",
  "secret": "your_secret",
  "version": "1.0.0"
}

WARNING

Send the raw secret. Do not hash or transform it on the client side.

AUTH_RESULT

Direction: server to client.

Sent after authentication succeeds or fails.

FieldTypeRequiredDescription
typestringYesAlways AUTH_RESULT
successbooleanYesWhether authentication succeeded
app_idstringYesApplication identifier parsed from the request
app_namestringNoApplication display name when available
messagestringYesHuman-readable result
server_timenumberYesUnix timestamp in milliseconds
versionstringYesServer protocol version
error_codestringNoPresent when authentication fails

Success:

json
{
  "type": "AUTH_RESULT",
  "success": true,
  "app_id": "your_app_id",
  "app_name": "Example App",
  "message": "Authentication successful",
  "server_time": 1786010400000,
  "version": "1.0.0"
}

Failure:

json
{
  "type": "AUTH_RESULT",
  "success": false,
  "app_id": "your_app_id",
  "message": "Invalid credentials",
  "server_time": 1786010400000,
  "version": "1.0.0",
  "error_code": "INVALID_CREDENTIALS"
}

Policy checks

Authentication succeeds only when all checks pass:

  • Local data access is enabled.
  • app_id exists in the allowlist.
  • key_id matches the configured key.
  • secret matches the issued credential.
  • Total connection count is below the policy limit.
  • Per-app connection count is below the policy limit.