Protects unauthorized access to content with temporary tokens
Temporary token calculated by the middleware on the server side when client requests playlist. Token contains next parts:
All parts should be separated by minus sign and addedd to the channels address. For example: https://example.com:8100/tv/travel-channel/index.m3u8?token=e8bff06f373694dda657e8417fe76f6b54b69807-a5cd6c00-1669890000-1669810000
Hash should be calculated on middleware with SHA1 algorithm from string concatenated from next parts:
Create a file securetoken.php
with the following code:
<?php
$channel = '/tv/travel-channel/index.m3u8';
$client = '192.168.88.98';
$starttime = 1669810000;
$endtime = 1669890000;
$securetoken = 'secret';
$salt = 'a5cd6c00';
$hash = sha1($channel . $client . $starttime . $endtime . $securetoken . $salt);
$token = $hash . '-' . $salt . '-' . $endtime . '-' . $starttime;
echo 'https://example.com:8100' . $stream . '?token=' . $token . PHP_EOL;
Launch script:
php securetoken.php
You will see line from the first example. Please, note, this script only for example.