Hello,
I use tokens in vod streaming. But when I test the resulting url address it gives 403 Forbidden error. Can you help me?
Version: 4.8.0
Example code I wrote in Node.js and the setting screenshot I made in wowza panel:
var crypto = require(‘crypto’);
var express = require(‘express’);
var contentURL = ‘http://192.168.1.1:1935/vod/sample.mp4/playlist.m3u8’
var sharedSecret = ‘xxxxxxxxxx’;
var contentPath = ‘/vod/sample.mp4’;
var customSecureTokenPrefix = ‘myTokenPrefix’;
var CustomParameter = ‘abcdef’;
const date = new Date().valueOf()
var starttime = date;
var endtime = date + 12000;
var toHash = contentPath + ‘?’ +
sharedSecret + ‘&’ +
customSecureTokenPrefix + ‘CustomParameter=’ + CustomParameter + ‘&’ +
customSecureTokenPrefix + ‘endtime=’ + endtime + ‘&’ +
customSecureTokenPrefix + ‘starttime=’ + starttime;
console.log("string for hash : " + toHash);
var hash = crypto.createHash(‘sha256’).
update(toHash, “utf8”).
digest(‘base64’);
hash = hash.replace(///g, ‘_’);
hash = hash.replace(/+/g, ‘-’);
var hlsURL = 'http://192.168.1.1:1935/vod/sample.mp4/playlist.m3u8?’ +
customSecureTokenPrefix + ‘starttime=’ + starttime + ‘&’ +
customSecureTokenPrefix + ‘endTime=’ + endtime + ‘&’ +
customSecureTokenPrefix + ‘CustomParameter=’ + CustomParameter + ‘&’ +
‘myTokenPrefixhash=’ + hash;
console.log("url for hls : " + hlsURL)
string for hash : string for hash : /vod/sample.mp4?xxxxxxxxxx&myTokenPrefixCustomParameter=abcdef&myTokenPrefixendtime=1586533227613&myTokenPrefixstarttime=1586533215613
Thank you.