Configure secure token
Do the first three steps in Gcore Customer Portal on the Secure token tab.

http://cdn.example.com/photo.jpegis the path to the file,DMF1ucDxtHCxwYQis the output of the “MD5(String)” hash function, where String is the parameter obtained by merging elements:<link expiry time><file path><allowlisted IP address><key from Step 2>,2147483647is the time in the UNIX timestamp format until which the link is considered valid.
How secure token URL matching works
Secure Token validates three things from the request URL:md5: the token hash.expires: the Unix timestamp until which the URL is valid.- Path: the file path or directory path that was used when the token was generated.
Token for exact file
Use an exact file token for standalone files such as images, archives, MP4 files or one protected video manifest when you do not need to authorize nested requests with the same token. Example protected file:/images/poster.jpeg. This token does not provide access to adjacent files, for example:
Token with Query String Forwarding
Use a token with Query String Forwarding enabled for HLS and MPEG-DASH when the player must request a master manifest, nested rendition manifests, media segments, and subtitles under the same path. In this mode, do not include a filename in token generation. Generate the token for the full directory path only. For example, for files in:/videos/video-1/. It does not work for files in subdirectories such as /videos/video-1/360p/. If your HLS or MPEG-DASH files are split across subdirectories, generate and use tokens for those directories separately or place the related manifests and segments under one directory.
Example HLS files:
- manifest URL: master.m3u8
- hls.js player demo: master.m3u8
Token in a path
Tokens embedded into the URL path are not supported for now by CDN natively. This option is available for Gcore Video Streaming:https://demo-protected.gvideo.iois the CDN URL,/videos/2675_pG8TfmKx2LU2qs/is the video ID,rI1224fiE3USCa8qYnMuGQis the token,1861919999is the expiration time in the UNIX timestamp format until which the link is considered valid.
Scripts for link generation
Generate links with a secure token in PHP
Below is the script for creating temporary links with the IP-based access restriction. The files will be accessible only from an allowlisted IP address and only until the link expires.- $secret is the secret key,
- $path is the path to the file,
- $ip is the IP address that is allowed to access the content,
- $expires is the link expiry time (in seconds),
- $url is the address of the file.
Generate links with a secure token in Python
The script for creating temporary links with the IP-based access restriction. The files will be accessible only from an allowlisted IP address and only until the link expires.- secret is the secret key,
- path is the path to the file,
- ip is the IP address that is allowed to access the content,
- expires is the link expiry time (in seconds),
- secured_url is the link to the file.
Generate a secure token in OpenSSL
The script for creating a secure token that limits the link lifespan and allows access only to an allowlisted IP:- 2147483647/images/1.jpg is the path to the file,
- 1.2.3.4 is the IP address that is allowed to access the content,
- secret_key is a secret key you specified at Step 2 of the Configure Secure Token instruction.

- http://cdn.example.com/photo.jpeg is the path to the file,
- DMF1ucDxtHCxwYQ is a secure token,
- 2147483647 is the time in the UNIX timestamp format until which the link is considered valid.