1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Secure a single key video stream
This guide explains how to prohibit access to Streaming video Infomaniak with a single key (hash).
Preamble
- This method offers the best level of protection and allows e.g. to restrict your broadcasts to a member space requiring authentication.
- As the way to generate this code is site-specific, it will be necessary to implement the required PHP functions and adapt your player's integration code accordingly.
Restrict access to single key broadcasts (hash)
To this end:
- 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 Parametersin the left side menu.
- Click on Restrictionsin the left side menu.
- Click on the tab Restriction by single hash:
Operation of restrictions
This method requires to retrieve information related to the configuration of your stream and the user that connects.
It is first necessary to define a password (a key) at the level of the Manager Infomaniak. Once this key is added, connected spectators and those trying to view your feed will be blocked instantly.
Here is the principle to allow access to your stream:
- Design of an authentication system by you (e.g. a member area).
- Take the password configured above on the Manager.
- Recover IP from Internet users via
$_SERVER["REMOTE_ADDR"]
e.g. - Take the flow identifier to be targeted.
- Recover the date as well as the current time (without minutes and seconds).
These elements will then be hashed by the code provided in the Manager in order to generate a unique and unique token for each user who will be transmitted to the stream at the time of loading. The streaming platform will then check the validity of the hash to allow or reject the connection.
Important remarks
- In order to ensure safe access to the flow, the validity of each token is limited in time.
- It is important to disable the cache on pages that allow access to the stream; indeed, if the generation of the token is cached, other users will try to authenticate themselves with someone else's hash, which will cause their rejection even if they have the permission to consume the stream.