StormChanger StormChanger - 1 year ago 111
Node.js Question

How to implement Evercookie in sails.js/node.js?

I followed the link as

First created a middleware for connect in config/http.js

and then followed the link :

Results In chrome Console :

Storage mechanism userData returned: undefined<br>
Storage mechanism cookieData returned: undefined<br>
Storage mechanism localData returned: 12345<br>
Storage mechanism globalData returned: undefined<br>
Storage mechanism sessionData returned: 12345<br>
Storage mechanism windowData returned: 12345<br>
Storage mechanism historyData returned: undefined<br>
Storage mechanism pngData returned: undefined<br>
Storage mechanism etagData returned: <br>
Storage mechanism cacheData returned: <br>
Storage mechanism dbData returned: 12345<br>
Storage mechanism lsoData returned: undefined<br>
Storage mechanism slData returned: undefined<br>

At front end Java script it is giving the correct id in alert as I set.

At Server Side : I get the cookieValue= undefined

Kindle help me whether this is the right way or I am missing anything in between.

Answer Source

I tried a lot then used evercookie.js file from the website "" itself.

then make changes in http middleware given as follows :

var evercookie = require('evercookie');
    var cookieParser = require('cookie-parser');
    app.use(require('connect').static(__dirname +'../public')); // be careful, you may want to use path.join instead!
      pngCookieName: 'evercookie_png',
      etagCookieName: 'evercookie_etag',
      cacheCookieName: 'evercookie_cache',
      pngPath: '/path/evercookie_png.php',
      etagPath: '/path/evercookie_etag.php',
      cachePath: '/path/evercookie_cache.php'

Note: 'path' is a location from where ec.set and ec.get method is called. Now I am able to get cookie data for etagData, cacheData and cacheData.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download