# Can't get Stream Target Token working with NodeJS

**URL:** https://community.wowza.com/t/cant-get-stream-target-token-working-with-nodejs/48440
**Category:** Wowza Developer Dojo
**Created:** [April 3, 2017, 7:44pm UTC](https://community.wowza.com/t/cant-get-stream-target-token-working-with-nodejs/48440 "2017-04-03T19:44:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Ed\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@Ed\_Lopez](https://community.wowza.com/u/Ed_Lopez)
#### Post date: [April 3, 2017, 7:44pm UTC](https://community.wowza.com/t/cant-get-stream-target-token-working-with-nodejs/48440/1 "2017-04-03T19:44:26Z")

</div>

I am trying to get tokenization working for a Stream Target in the Wowza Cloud. I am using Node.js (the only language where an example was not provided), I went through both the Python and PHP examples multiple times to make sure that I was adding the proper/required parameters, and I also compared the output to the generated hashes… Their query parameters work, whereas mine do not. Could someone tell me what I am missing here?

Wowza Generates:  
?hdnts=exp=1491247947~acl=\*~hmac=495bbcdd8d2d88adf036fd5f8756aa91c6cb91a35fe38428ffaa0f669264b030

My Code Generates: ?hdnts=exp=1491680344~acl=\*~hmac=76f0022f5f68e7b0c071b683243ccf15a0ed0fea6dc9b653943a438c08577261

```auto
app.get('/token/', function(req, res){
	var end_time = moment().add(5, 'days').unix();
    var acl = "*";

    newToken = "exp=" + end_time + "acl=" + acl;
    var hash = crypto.createHmac('sha256', wowzaSecret);
        hash.setEncoding('hex');
        hash.write(newToken);
        hash.end();

    var hmac = hash.read();

    var returnHash = "?hdnts=exp=" + end_time + "~acl=*~hmac=" + hmac
    
    res.json({data: returnHash})

   //Return Hash Generates   
// ?hdnts=exp=1491680344~acl=*~hmac=76f0022f5f68e7b0c071b683243ccf15a0ed0fea6dc9b653943a438c08577261//Compared the the Test Hash generated by wowza// ?hdnts=exp=1491247947~acl=*~hmac=495bbcdd8d2d88adf036fd5f8756aa91c6cb91a35fe38428ffaa0f669264b030
});

```
