1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Secure single key videos
This guide explains how to protect by single key imported videos on a VOD service Infomaniak.
Protecting a single key video
You have the opportunity to protect all media from a file with the creation of a token. The latter will be unique for each of your visitors and will have to be passed as a parameter to your media in order to limit the latter's consultation. Only you will be able to generate the unique key, necessary for each user to see the videos. This key allows you to allow only persons previously verified by you.
This makes it possible to control access to videos and allow only some people, while others are denied. Useful in cases such as pay-per-view or limited broadcasts. However, please note that it is up to you to develop integration into your existing system.
If the hash is not valid, access to the video will return an error page "403 forbidden".
Enable restriction on import folder
When the password is set once and for all at the destination folder, all new media imports will automatically include this mode when they are read. To configure this folder:
- Click here in order to access the management of your product on the Manager Infomaniak (Need help?).
- Click directly on the nameallocated to the product concerned.
- Click on Media in the left side menu.
- Click on Media management in the left side menu.
- Click on the icon to create a New folder:
- Give the file a name.
- Click the blue button for Create Folder.
- Click on Configuration:
- Choose encoding rules for videos that will be imported and then proceed to the next step.
- Configure the folder options in this second step and proceed to the next step.
- Activate the one-key restriction.
- Click the blue button once the different restrictions are set:
1. Create a token API VOD
To access the VOD API, you must first authenticate with a token application. This step is only to be done once. The application token will be common for all the files you wish to protect. To create this application token, take note of this other guide and documentation https://developer.infomaniak.com/getting-started#authentication.
2. Create playback token
This step will be done on your website/application and this token will have to be unique, so generated for each visitor.
It is therefore important that the page that will have as its role the generation of token does not have a cache, in order to guarantee the uniqueness of the token.
POST https://api.vod2.infomaniak.com/api/pub/v1/channel/channel_id/share/share_id/token
channel_id
= 1227share_id
= matches the ID of your video
Example: https://api.vod2.infomaniak.com/res/embed/1jhvl2uqa5rdf.html
The list of parameters is available in the documentationhttps://developer.infomaniak.com/docs/api/post/channel/share/token
3. Using the unique token on a media
The token recovered in point 2 above will be passed as a parameter to the media, it will be unique therefore different for each visitor:
<iframe frameborder="0" width="720" height="360" src="https://api.vod2.infomaniak.com/res/embed/1jhvl2uqa5rdf.html?token=st=1637143497~exp=1637143797~acl=/hls/1jhvl2uq4dnra/1jhvl2uq4dnmd/*~hmac=914aa838bdba141ec85db74266b54278572a1353a49e8851e4fd096dc6372127" allowfullscreen></iframe>