NICE re/streamer pro

Guides

Auth token: let your own backend allow each stream

Your own backend (Ministra/Stalker, a website, a billing) hands out tokens; the panel asks it about every token before it starts a stream.

How it works

  1. Your backend gives the client a token, e.g. 12345678.
  2. The client asks the panel for a channel with it: http://host:3000/1?token=12345678 (HLS: http://host:9888/1.m3u8?token=12345678).
  3. The panel asks your backend: <Auth token address>12345678.
  4. Your backend answers 200 OK with the headers X-Unique: true and X-UserId: <user id> – the panel starts the stream. Any other answer (e.g. 403 Forbidden) – the request is refused.

1Set the address in the panel

Configuration → SYSTEM → Auth token: the address of your check, ending with token=. It must start with http and contain token=, otherwise the check is off.

Configuration → SYSTEM: the Auth token field
http://backend.example.com/check_token.php?token=

2Ministra / Stalker

Ministra has the check built in (its Flussonic temporary links):

# Auth token in the panel
http://ministra-host/stalker_portal/server/api/chk_flussonic_tmp_link.php?token=

In Ministra, in the channel settings, turn on the Flussonic temporary link (temporary URL) for the channels served by the panel.

3Your own backend – PHP example

<?php   // check_token.php
$nr = '203.0.113.10';                       // the panel's IP – only it may ask
if ($_SERVER['REMOTE_ADDR'] !== $nr || empty($_GET['token'])) {
  header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); exit;
}
$uid = check_token($_GET['token']);          // your own lookup: token → user id, or false
if (!$uid) {
  header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); exit;
}
header('X-Unique: true');
header('X-UserId: ' . $uid);
header($_SERVER['SERVER_PROTOCOL'] . ' 200 OK');

function check_token($t) { return $t === '12345678' ? 'user-1' : false; }
?>