trailsjs / sails-auth

Passport-based User Authentication system for sails.js applications. Designed to work well with the sails-permissions module.
https://www.npmjs.org/package/sails-auth
MIT License
266 stars 141 forks source link

Can't use local authentication with 2.0.0-alpha2 #85

Open wbprice opened 9 years ago

wbprice commented 9 years ago

Following this guide, I was unable to authenticate passing identifier and password to POST /auth/local. After downgrading sails-auth to 1.3.1, everything worked as expected.

wbprice commented 9 years ago

Hi Raul. I've spoken about this with both of the maintainers of sails-auth pretty extensively (one of whom wrote the article), so they're aware of the details. However:

Replication Steps

error: Sending 500 ("Server Error") response: 
 Error: Unknown authentication strategy "local"
    at attempt (/Users/blaine/Documents/reviews/node_modules/sails-permissions/node_modules/sails-auth/node_modules/passport/lib/middleware/authenticate.js:166:37)

Package.json

{
  "name": "reviews",
  "private": true,
  "version": "0.0.0",
  "description": "a Sails application",
  "keywords": [],
  "dependencies": {
    "ejs": "~0.8.4",
    "grunt": "0.4.2",
    "grunt-contrib-clean": "~0.5.0",
    "grunt-contrib-coffee": "~0.10.1",
    "grunt-contrib-concat": "~0.3.0",
    "grunt-contrib-copy": "~0.5.0",
    "grunt-contrib-cssmin": "~0.9.0",
    "grunt-contrib-jst": "~0.6.0",
    "grunt-contrib-less": "0.11.1",
    "grunt-contrib-uglify": "~0.4.0",
    "grunt-contrib-watch": "~0.5.3",
    "grunt-sails-linker": "~0.9.5",
    "grunt-sync": "~0.0.4",
    "include-all": "~0.1.3",
    "lodash": "^3.10.1",
    "rc": "~0.5.0",
    "sails": "~0.11.0",
    "sails-auth": "^2.0.0",
    "sails-disk": "~0.10.0",
    "sails-permissions": "^1.4.4"
  },
  "scripts": {
    "debug": "node debug app.js",
    "start": "node app.js"
  },
  "main": "app.js",
  "repository": {
    "type": "git",
    "url": "git://github.com/wbprice/reviews.git"
  },
  "author": "wbprice",
  "license": ""
}

As noted above, reverting to an earlier version of sails-auth fixes the issue. Above POST request behaves as expected.

wasd171 commented 9 years ago

I confirm this issue with sails-auth@2.0.0

YoleYu commented 8 years ago

I meet this problem, resolved by following:

change your config/bootstrap.js to load your Passport providers on startup by adding the following line: sails.services.passport.loadStrategies();