I’m trying to generate tokens. I wish it was simple like PEM certificate JWT tokens which is more secure than salt secret key based tokens.
My helper method looks like this so far
public static function generateWowzaToken(string $streamName, string $clientIP, int $expiry) {
$wowzaContentPath = self::getContentPath($streamName);
$wowzaSecureToken = config('video.wowzaTokenSecret');
$wowzaTokenPrefix = config('video.wowzaTokenPrefix');
$wowzaLiveApp = config('video.wowzaLiveApp');
//$wowzaContentPath = $wowzaLiveApp."/".$streamName."/".$streamName;
$wowzaSecureTokenStartTime = $wowzaTokenPrefix ."starttime=". time() ;
$wowzaSecureTokenEndTime = $wowzaTokenPrefix ."endtime=". (time() + $expiry );
$hashstr = $wowzaContentPath ."?". $clientIP ."&".$wowzaSecureToken ."&". $wowzaSecureTokenEndTime ."&". $wowzaSecureTokenStartTime;
$hash = hash(config('video.wowzaHashAlgorithm'), $hashstr , true);
$usableHash=strtr(base64_encode($hash), '+/', '-_');
return $wowzaSecureTokenEndTime."&".$wowzaSecureTokenStartTime."&".$wowzaTokenPrefix ."hash=$usableHash";
//$url = $wowzaContentURL ."?". $wowzaTokenPrefix ."=$usableHash";
}
And generates urls like
/live/livestream/livestream/playlist.m3u8?tendtime=1720999771&tstarttime=1720999471&thash=jY-nlnk-JEPsN7b-ASArtkdRvKUj6_ggIVwtcVd21VY73v9f9FxLpM9R4VNKAovCnGHuoQslF6gQktkp5xSysw==
Wowza isn’t accepting the connection and all I get is a log like this without an indication what the problem is
HTTPStreamerAdapterCupertinoStreamer.onPlaylist[live/livestream/livestream/playlist.m3u8?tendtime=1720999771&tstarttime=1720999471&thash=jY-nlnk-JEPsN7b-ASArtkdRvKUj6_ggIVwtcVd21VY73v9f9FxLpM9R4VNKAovCnGHuoQslF6gQktkp5xSysw==]: Session not accepted[1788740773]
My test token server config looks like