Skip to content

asemoon/sails-token-auth-setup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

#SailsJs Token Based Authentication Setup

Globals

$ npm install -g sails

Create a sails app

$ sails new myApp
$ cd myApp

Files

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

Install Dependencies

$ npm install --save passport
$ npm install --save passport-local
$ npm install --save bcrypt-nodejs
$ npm install --save jsonwebtoken
$ npm install --save express-jwt

Endpoints

Create user

POST user/

Login

POST auth/login

Logout

DELETE auth/logout

Validate Token

POST auth/validate_token

About

Token based authentication installation guide

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%