Knowledge base
1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!
Secure videos with a unique key
This guide explains how to protect imported videos on an Infomaniak VOD service using a unique key.
Introduction
- Please note that the protection is only effective when using a standard iframe integration and therefore through the use of the Infomaniak Player.
- Other access restrictions can be enabled: password | geoip
- You can manage the preview images used when restricting access.
Protect a video with a unique key
You have the option to protect all media in a folder by creating a token. This token will be unique for each of your visitors and must be passed as a parameter to your media in order to limit access to it. Only you will be able to generate the unique key, which is required for each user to view the videos. This key therefore allows you to authorize only those people who have been previously verified by you.
This allows you to control access to videos and authorize only certain people, while others are refused; useful in cases such as pay-per-view or limited broadcasts. However, please note that it is up to you to develop the integration with your existing system.
If the hash is not valid, access to the video will return a "403 forbidden" error page.
Enable the restriction on the import folder
When a password is defined once for the destination folder, all new media imports will automatically include this mode when played. To configure this folder:
- Click here to access the management of your VOD/AOD in the Infomaniak Manager (need help?).
- Click directly on the name assigned to the product in question:

- Click on Media in the left-hand menu.
- Click on Media Management in the left-hand menu.
- Click on the icon to create a New folder:

- Give the folder a name.
- Click on the blue button to Create the folder.
- Click on Configuration:

- Click on the Restrictions tab.
- If necessary, disable the toggle switch to remove the inheritance from the parent folder, so that you can configure your own rules for this specific folder.
- Enable the toggle switch to configure the restriction by unique key.
- Click on Save once the various desired options have been configured:

1. Create a VOD API token
To access the VOD API, you must first authenticate using a token (this only needs to be done once – it will be valid for all folders you want to protect); refer to this other guide and then to the documentation https://developer.infomaniak.com/getting-started#authentication.
2. Create the playback token
This step must be performed on your website/application, and this token must be unique, so it must be generated for each visitor.
Therefore, it is important that the page responsible for generating the token does not have any 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/tokenchannel_id = 1227share_id = corresponds to the identifier of your video
Example: https://api.vod2.infomaniak.com/res/embed/1jhvl2uqa5rdf.html
The list of parameters is available in the documentation https://developer.infomaniak.com/docs/api/post/channel/share/token
3. Using the unique token on a media
The token retrieved in step 2 above will be passed as a parameter to the media; it will be unique and 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>Link to this FAQ: https://faq.infomaniak.com/1366
Has this FAQ been helpful?