Skip to content

Latest commit

 

History

History
69 lines (54 loc) · 2.36 KB

README.md

File metadata and controls

69 lines (54 loc) · 2.36 KB

auth

NPM version Build status Dependency Status

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.

1. Install

$ npm install sails-auth --save

This will install sails-auth has a Sails.js Hook. The Hook uses marlinspike to extend the relevant Models, Controllers, etc.

2. Setup Policies

config/policies.js

  '*': [ 'basicAuth', 'passport', 'sessionAuth' ],

  AuthController: {
    '*': [ 'passport' ]
  }

The policies above secure everything by default, including registration. If you'd like to open registration to all users, 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

Maintained By