The Secure token is a Gcore CDN feature that helps to protect files from unwanted downloading. You will find more information about the feature in the "About Secure Token" article.
As far as streaming is concerned, protection using a Secure token is as follows:
1. A live stream or video is received into the Streaming Platform with no Secure token protection.
2. Streaming Platform transcodes the content and forwards it to CDN for delivery.
3. The Secure token will be added to the following URLs:
https://123456.gvideo.io/streams/123456_WG99BSGMdZIwKy/1552551429/playlist.m3u8
(live stream);https://123456.gvideo.io/videos/123456_aJ0o71wfUwJvFDklkjlcu/master.m3u8
(VoD)1. Go to the CDN resources section and open the settings of the CDN resource used for the streaming.
2. Go to the "Access" section, select Secure token, and enable the feature.
3. Enter a signature key between 6 and 32 characters and click Save changes.
Note: Leave the "Add a client's IP to the token" box unchecked.
Once the feature is enabled, a PHP script can generate temporary links for live streams and videos on demand (VoDs).
<?php $secret = 'iFCjcOAhQ'; $vhost = '123456.gvideo.io'; $client_id = '1'; $stream_id = '123'; $expires = time() + 10000; $link = "{$client_id}{$stream_id}${secret}${expires}"; $md5 = md5($link, true); $md5 = base64_encode($md5); $md5 = strtr($md5, '+/', '-'); $md5 = str_replace('=', '', $md5); $url = "https://{$vhost}/streams/{$client_id}${stream_id}/${md5}/${expires}/playlist.m3u8"; echo $url; echo "\n";>
Where you need to substitute your values after the equals in the following lines:
https://123456.gvideo.io/videos/123456_AHgywxonRd8F9ctX
, AHgywxonRd8F9ctX is a slug.Was this article helpful?
Explore the Streaming Platform by Gcore