Skip to content
/ sails-auth Public
forked from trailsjs/sails-auth

Passport-based User Authentication system for sails.js applications. Designed to work well with the sails-permissions module.

License

Notifications You must be signed in to change notification settings

d4f/sails-auth

 
 

Repository files navigation

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

About

Passport-based User Authentication system for sails.js applications. Designed to work well with the sails-permissions module.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%