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
265 stars 141 forks source link

local strategy, POST /auth/local return 403 #87

Open sylvainlap opened 8 years ago

sylvainlap commented 8 years ago

Hello,

I tried sails-auth (v1.3.1), and followed the README.

I created a new user thanks to POST /user, with {"email":"admin@example.com","password":"admin123"}, and then tried to login thanks to POST /auth/local with the same body, and sails-auth returns a 403 error. What am I doing wrong ?

Thanks, Sylvain

ryanwilliamquinn commented 8 years ago

https://github.com/tjwebb/sails-auth/wiki/Logging-In

To login, you should send identity and password. I would assume that the email would be the value of the identity key.

sylvainlap commented 8 years ago

Yes, it worked. Thanks ! And is that possible to set the identifier as another attribute, for example the username instead of the email ?

westlakem commented 7 years ago

I know this is old but it's still an open discussion. Can we change that request to a 400 error instead of a 403? 403 is "you do not have permission" and 400 is "bad request" (which missing a required field is)

Simone-cogno commented 7 years ago

how to redirect to an error page if the login fails?