Custom Sign Servers
Basic guidance on creating a custom signature server for TikTokLive libraries.
Is it possible to create a custom server for the TikTokLive libraries? Yes! This guide gives basic guidance on how. We know that this hurts our business, but we believe in the power of open source and the freedom to choose.
All libraries as of August 21st, 2024
implement a specific signature endpoint. If you replicate this endpoint, you can use the libraries with your own signature server.
Generating Signatures
Unfortunately, we cannot provide a guide on how to generate signatures. This is because the signature generation is proprietary and is not open source. We are happy to help you implement the signature endpoint, but we cannot provide the code for it.
The /webcast/fetch
endpoint
First and foremost you need to implement the /webcast/fetch
endpoint. This endpoint is responsible for generating the signature for the TikTok WebSocket server and embedding it in a protobuf payload.
The expected response type is a generated protobuf byte-stream. You can grab this from TikTok instead of generating it yourself by generating a URL & applying a signature to it.
Required Signature Parameters:
X-Bogus
_signature
msToken
Verified Parameters:
browser_name
(Query)browser_version
(Query)User-Agent
(Header)
If you do not provide a User-Agent that matches the browser name and version, TikTok will reject your request.
Here is a basic example of how to fetch the protobuf from TikTok:
Once you've managed to reverse-engineer a signature method & fetch the protobuf, you can return this from the /webcast/fetch
endpoint of your custom server.
The /sign_url
endpoint
This endpoint is a legacy endpoint that is no longer used by most of the TikTokLive libraries. It is only in use by the Node.JS library. You must make this endpoint return a JSON object with the following properties: