# Wowza SecureToken version 2 configuration (?)

**URL:** <https://community.wowza.com/t/wowza-securetoken-version-2-configuration/43404>\
**Category:** Wowza Streaming Engine\
**Created:** [December 21, 2016, 11:24am UTC](https://community.wowza.com/t/wowza-securetoken-version-2-configuration/43404 "2016-12-21T11:24:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![david\_slt](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@david\_slt](https://community.wowza.com/u/david_slt)\
**Post date:** [December 21, 2016, 11:24am UTC](https://community.wowza.com/t/wowza-securetoken-version-2-configuration/43404/1 "2016-12-21T11:24:04Z")

</div>

Hello,

I want to use the SecureToken version 2 to protect my live and vod streams

i did search the froum and found the php code in these topics

```auto
http://community.wowza.com/t/-/47255
http://community.wowza.com/t/-/46955

```

unfortunately it doesn’t work for me and i can not play the sample.mp4 test stream

I has updated my wowza installation to latest version 4.6 and want to use the wowza internal hash protection instead of wmspanel.

is there anything missed in my configuration ?

Thank you in advance.

here is the configuration:

Wowza server: 192.168.1.1

SecureToken: Protect all protocols using hash (SecureToken version 2)

Shared Secret: abcde

Include client IP address in hash generation : Enabled

Hash Query Parameter Prefix : wowzatoken

Webserver : 192.168.1.2

client load the JW player : 192.168.1.2

Time & date : the same in Wowza , Webserver and client

```auto
<?php 
$clientIP = 192.168.1.2; // i did set null for disabled Client ip address test.
$host = "192.168.1.1"; // your ip/host 
$url= "rtmp://".$host.":1935/"; 
$stream = "vod/_definst_/mp4:sample.mp4"; // your stream 
$start = time(); 
$end = strtotime("+30 minutes"); 
$secret = "abcde"; 
$tokenName = "wowzatoken"; 
$hash = ""; 
if(is_null($clientIP)){ 
        $hash = hash('sha384', $stream."?".$secret."&{$tokenName}endtime=".$end."&{$tokenName}starttime=".$start, true); // generate the hash string 
} 
else{ 
        $hash = hash('sha384', $stream."?".$clientIP."&".$secret."&{$tokenName}endtime=".$end."&{$tokenName}starttime=".$start, true); // generate the hash string 
} 
$base64Hash = strtr(base64_encode($hash), '+/', '-_'); 
// $params = array("{$tokenName}starttime=".$start, "{$tokenName}endtime=".$end, "{$tokenName}hash=".$base64Hash); 
$params = array("{$tokenName}starttime=".$start, "{$tokenName}endtime=".$end, "{$tokenName}hash=".$base64Hash); 
if(!is_null($clientIP)){ 
        $params[] = $clientIP; 
} 
sort($params); 
$playbackURL = $url.$stream."/playlist.m3u8?"; 
if(preg_match("/(rtmp)/",$url)){ 
        $playbackURL = $url.$stream."?"; 
} 
foreach($params as $entry){ 
        $playbackURL.= $entry."&"; 
} 
$playbackURL = preg_replace("/(\&)$/","", $playbackURL); 
// echo "$playbackURL"; // DEBUG - show fully formed URL 
?>

```

if client ip address be enabled:

```auto
rtmp://192.168.1.1:1935/vod/_definst_/mp4:sample.mp4?192.168.1.2&wowzatokenendtime=1482324374&wowzatokenhash=3XoQIHe89wzcNY5KpFJeSbtyxGDi86s1IIJILyzFdoc=&wowzatokenstarttime=1482322574&

```

if the client ip address be disabled:

```auto
rtmp://192.168.1.1:1935/vod/_definst_/mp4:sample.mp4?&wowzatokenendtime=1482349546&wowzatokenhash=0k4pQZBJkUQhmqbeAoT-LKia6DOwVv9eUjspU99wYQmif2N10gbDPqffMa0legeJ&wowzatokenstarttime=1482347746

```

---

<div class="post-metadata">

**Author:** ![david\_slt](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@david\_slt](https://community.wowza.com/u/david_slt)\
**Post date:** [December 23, 2016, 10:35pm UTC](https://community.wowza.com/t/wowza-securetoken-version-2-configuration/43404/2 "2016-12-23T22:35:10Z")

</div>

3 days , 28 views and no answer !

can anyone please help me solve this problem ?

---

<div class="post-metadata">

**Author:** ![david\_slt](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@david\_slt](https://community.wowza.com/u/david_slt)\
**Post date:** [December 27, 2016, 1:53pm UTC](https://community.wowza.com/t/wowza-securetoken-version-2-configuration/43404/3 "2016-12-27T13:53:59Z")

</div>

hello,

thank you ,i’m waiting for new software update

---

<div class="post-metadata">

**Author:** ![Alex\_C](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@Alex\_C](https://community.wowza.com/u/Alex_C)\
**Post date:** [December 27, 2016, 1:41am UTC](https://community.wowza.com/t/wowza-securetoken-version-2-configuration/43404/4 "2016-12-27T01:41:36Z")

</div>

Hello david007,

This issue has been reported and our development team is working on a fix which should be rolled out soon.

You can subscribe to the update RSS feed to stay up on when a new update is released.

[Wowza Software Updates](https://www.wowza.com/docs/software-updates)

If you have further questions, please open a ticket with our support group [here](https://www.wowza.com/support/open-ticket).

Regards,

Alex

---

<div class="post-metadata">

**Author:** ![Balaji\_Nagalgave](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@Balaji\_Nagalgave](https://community.wowza.com/u/Balaji_Nagalgave)\
**Post date:** [May 4, 2017, 6:58am UTC](https://community.wowza.com/t/wowza-securetoken-version-2-configuration/43404/5 "2017-05-04T06:58:13Z")

</div>

what the issue resolved ? whats the url to play after token applied
