Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update strategy to work with no field #91

Closed
wants to merge 1 commit into from

Conversation

jbltx
Copy link

@jbltx jbltx commented Dec 20, 2014

It could be very useful to have the option to permit send request with no body. For example, we can use an usual login strategy with username and password, OR a cookie-based login if username and password fields are not given. I tried myself and it was a success, we don't need to send a 400 status error because we can handle it further.

It could be very useful to have the option to permit send request with no body. For example, we cam use an usual login strategy with username and password, OR a cookie based login if username and password fields are not given.
@NemoStein
Copy link

I was about to fork the repo to do exactly what you did.
I can't see any reason why not merge this.

@jaredhanson
Copy link
Owner

Multiple authentication strategies can be attempted as follows:

passport.authenticate(['local', 'cookie-based-strategy'])

If the first strategy fails, the second one will be attempted. Authentication succeeds if any one strategy succeeds, or fails if all strategies fail. There is no need for additional options in the strategies themselves.

@kimmobrunfeldt
Copy link

@jaredhanson I would want this feature for different reasons. I'd like that all errors are handled by my custom error handling middleware in express. Now passport-local responds to the error directly and doesn't continue the middleware-flow. Do you have any ideas how I could improve the error message? It's not very informative to respond simply 'Bad Request' to my API users.

@vuaru
Copy link

vuaru commented Dec 17, 2015

This is exactly why I would want this feature as well.
What is the point of a custom callback if it is arbitrarily bypassed?

@alexlawrence
Copy link

+1

@wallace-sf
Copy link

I guess the point here is the i would like to create my custom response. If the library handle the express response error, then i can't create my custom error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants