Using JSON webtoken authentication for consuming rest-api from your Single Page Application is pretty common these days.
In this post I’ll be helping you to use it in your Sails.js App. Well’ll be using simplest user name and password for user sign-up/in.
Prerequisite: I am assuming you have a sails app with a User model. You need to run
npm i jsonwebtoken bcrypt --save to get necessary dependencies for this tutorial.