sails-auth icon indicating copy to clipboard operation
sails-auth copied to clipboard

local strategy, POST /auth/local return 403

Open sylvainlap opened this issue 9 years ago • 4 comments

Hello,

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

I created a new user thanks to POST /user, with {"email":"[email protected]","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

sylvainlap avatar Aug 31 '15 14:08 sylvainlap

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.

ryanwilliamquinn avatar Aug 31 '15 15:08 ryanwilliamquinn

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

sylvainlap avatar Aug 31 '15 15:08 sylvainlap

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)

westlakem avatar Oct 24 '16 00:10 westlakem

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

Simone-cogno avatar Nov 28 '16 10:11 Simone-cogno