Knowledge base
1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!
Restrict access to a video stream with a unique token
This guide explains how to restrict access to Infomaniak video streaming using a unique key (hash).
Introduction
- This method offers the best level of protection and allows you, for example, to restrict your broadcasts to a member area requiring authentication.
- Since the method of generating this code is specific to each site, it will be necessary to implement the required PHP functions and adapt the integration code for your player accordingly.
Restrict access to broadcasts using a unique key (hash)
To do this:
- Click here to access the management interface for your product in the Infomaniak Manager (need help?).
- Click directly on the name assigned to the product in question.
- Click on Settings in the left-hand menu.
- Click on Restrictions in the left-hand menu.
- Click on the Unique Hash Restriction tab (or the dropdown menu item):

How restrictions work
This method requires retrieving information related to your stream's configuration and the user connecting to it.
First, you need to create a password (a key) in the Infomaniak Manager. Once you add this key, viewers who are connected and those attempting to watch your stream will be instantly blocked (refer to this other guide to customize the replacement image offered to blocked viewers).

Here are the steps to follow to authorize access to your feed:
- Design an authentication system yourself (e.g., a members area).
- Use the password configured above in the Manager.
- Retrieve the IP address of internet users using
$_SERVER["REMOTE_ADDR"], for example. - Get the ID of the stream to target.
- Retrieve the current date and time (without minutes and seconds).
These elements will then be hashed by the code provided in the Manager to generate a unique token specific to each user, which will be transmitted to the stream when it is loaded. The streaming platform will then verify the validity of the hash to allow or reject the connection.

Important notes
- To ensure the security of access to the stream, the validity of each token is limited in time.
- It is important to disable the cache on the pages that allow access to the stream; indeed, if the token generation is cached, other users will attempt to authenticate with someone else's hash, which will cause them to be rejected even if they are authorized to access the stream.
Link to this FAQ: https://faq.infomaniak.com/2273
Has this FAQ been helpful?