#SailsJs Token Based Authentication Setup
$ npm install -g sails
$ sails new myApp
$ cd myApp
1 ) Copy every file to its corresponding folder
2 ) Add this to config/policies.js
'*': "hasToken",
UserController: {
"create": true
},
AuthController: {
'*': true
}
3 ) Change the value of config/tokenSecret.js
$ npm install --save passport
$ npm install --save passport-local
$ npm install --save bcrypt-nodejs
$ npm install --save jsonwebtoken
$ npm install --save express-jwt
Create user
POST user/
Login
POST auth/login
Logout
DELETE auth/logout
Validate Token
POST auth/validate_token