@muhammadghazali/sails-auth

1.5.0 • Public • Published

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.

Install

$ npm install sails-auth --save

Usage

1. configure .sailsrc

{
  "generators": {
    "modules": {
      "auth-api": "sails-auth/generator"
    }
  }
}

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

Maintained By

Package Sidebar

Install

npm i @muhammadghazali/sails-auth

Weekly Downloads

2

Version

1.5.0

License

MIT

Last publish

Collaborators

  • muhammadghazali