Secure Token is one of the enhanced security feature addon provided by 5centsCDN. Secure Token allows you to generate secured playback links with an expiration time. Once a token has expired, it is not possible anymore to access the content with it. This will make your content secure to a great extend and prevent playback URL theft.
Secure Token works with a secure code which is generated randomly and end user IP address, only incorporating both of these parameters the stream could be played.
In order to implement the Secure Token :
- Go to Live Streams > Push
- Click on the Manage button available right next to your desired Stream Name
- In the redirected page Select Secure Token.
- To enable this feature toggle the slider to Enable mode
- Click Generate and the Secure Token will be created. The corresponding Tokenized Playback URLs will be generated according to the secured token created earlier.
- The Token can be set with an expiration by adding Token Expiration (in secs)
- If you want to exclude a particular IP from these restrictions, add those in Allowed IPs
- Click on Save
The above steps will create a PHP script which Generates your tokens for the URLs and related Player Codes under the Playback URLs / Embed Code session. A sample php script generated for the Publishing Point 5cents/india1 with the secret key as secret123 is given below.
$key = ‘secret123’;
$path = ‘/5cents/india1/index.m3u8’;
$expire = time() + 2000; // current time + token timeout
$md5 = base64_encode(md5($key . $path . $expire , true));
$md5 = strtr($md5, ‘+/’, ‘-_’);
$md5 = str_replace(‘=’, ”, $md5);
$token = “st=$md5&e=$expire”;
//use “$hls” to initialize player
$hls = “https://livestream.5centscdn.com/5cents/india1/index.m3u8?$token”;
Please note that the direct HLS URL with the token will only be played back for the interval you have set in the token expiry. You can now host the PHP Script along with the available player code under a.php file and embed it on your website.
Feel free to contact our Technical Support for a Demo Page which will demonstrate how to embed your player along with the script.