Passport-based User Authentication system for sails.js applications.


512.3.12 years ago4 years agoMinified + gzip package size for @inspire-platform/sails-hook-auth in KB



NPM version

Passport-based User Authentication system for Sails.js applications.

1. Install

$ npm install @inspire-platform/sails-hook-auth --save

This will install @inspire-platform/sails-hook-auth as a Sails Hook.

2. Configure


By default, the local and basic strategies are enabled. See config/passport.js for examples of how to add and configure additional authentication strategies.


  bcrypt: {
     * Specifiy number of salt rounds to perform on password. Values >10 are
     * slow.
    rounds: 8

3. Authenticate!

Create users as you normally would (POST to /user). Authenticate using the endpoint of the provider you've chosen.


Authenticate with the local strategy via a POST to /auth/local with params identifier (email) and password). This will also create a session. See passport.local for more.

  • Custom User Lookup

    If you have additional Model(s) which contain User data by which you want to lookup local strategy users, you can override the AuthService.findUser(query, cb) method.

    Make sure you execute the callback!

    return cb(err, user);

HTTP Basic and Digest

See passport.http.

Additional Passport Strategies


Returns User for this authenticated session.


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.



Upstream Project Maintained By

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.