Clone this repository:
git clone https://github.com/liucijus/auth-workshop-node/
Change directory to auth-workshop-node/
Run npm install to fetch JavaScript dependencies
Start project in development mode by running npm run start-dev
Workshop prerequisites
Prior experience in programming is a must
Editor. Pick an editor which supports JavaScript syntax highlighting.
The best editor is one which you work daily. If you have hard time
making decision, pick Atom
// read cookieconstcookieParser=require('cookie');constcookieHeaderValue=req.header('cookie')||'';constmyCookie=cookieParser.parse(cookieHeaderValue).myCookie;// set cookie res.cookie('myCookie','my-cookie-value');// set cookie with some optionsres.cookie('another','another-cookie-value',{maxAge: 900000,httpOnly: true});
constcrypto=require('crypto-js');constSECRET='my secret password';constvalue=15;// make sure value is string before calculating hashconsthash=crypto.HmacSHA256(value.toString(),SECRET).toString();