auth
Passport-based User Authentication system for sails.js applications.
Note: For comprehensive user account control with role-based permissioning, object ownership, and row-level security, see sails-permissions, which uses this project as a dependency.
Install
$ npm install sails-auth --save
Usage
1. configure .sailsrc
{
"generators": {
"modules": {
"auth-api": "sails-auth"
}
}
}
2. install sails.js extension
$ sails generate auth-api
config/policies.js
'*': [ 'basicAuth', 'passport', 'sessionAuth' ],
AuthController: {
'*': [ 'passport' ]
}
The policies above secure everything by default, including registration. In case you wish to open it, add the following:
UserController: {
'create': true
}
3. authenticate!
Create users as you normally would (POST
to /user
). Authenticate using the
endpoint of the provider you've chosen.
/user/me
Returns User
for this authenticated session.
Passport Protocols
License
MIT