There are two standard ways to do authentication:
$ git clone https://github.com/kentcdodds/ng-jwt-workshop.git
$ cd ng-jwt-workshop/api
$ git checkout cookie
$ npm install
* Optionally copy user.json to a new user.local.json file and modify to have your own user
$ node index.js
$ open http://localhost:3000
127.0.0.1 api.jwtftw.dev127.0.0.1 www.jwtftw.dev
Stop the node server
$ git checkout -f cookie-pain-cors
$ node api/
Phew! No cors error...
Login... Get picture...
What? No picture? 403 error? Refresh page! Hey, it logged me out!?!?!?
Reason: Server cannot set cookies across subdomains...
Enter: JWT...
Please leave me feedback through the app... (Link at the bottom)
Now go build something awesome :-)