{"action":"created","issue":{"url":"https://api.github.com/repos/jaredhanson/passport-local/issues/131","repository_url":"https://api.github.com/repos/jaredhanson/passport-local","labels_url":"https://api.github.com/repos/jaredhanson/passport-local/issues/131/labels{/name}","comments_url":"https://api.github.com/repos/jaredhanson/passport-local/issues/131/comments","events_url":"https://api.github.com/repos/jaredhanson/passport-local/issues/131/events","html_url":"https://github.com/jaredhanson/passport-local/issues/131","id":139333724,"number":131,"title":"Middleware chain ended by library.","user":{"login":"Freyert","id":449155,"avatar_url":"https://avatars.githubusercontent.com/u/449155?v=3","gravatar_id":"","url":"https://api.github.com/users/Freyert","html_url":"https://github.com/Freyert","followers_url":"https://api.github.com/users/Freyert/followers","following_url":"https://api.github.com/users/Freyert/following{/other_user}","gists_url":"https://api.github.com/users/Freyert/gists{/gist_id}","starred_url":"https://api.github.com/users/Freyert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Freyert/subscriptions","organizations_url":"https://api.github.com/users/Freyert/orgs","repos_url":"https://api.github.com/users/Freyert/repos","events_url":"https://api.github.com/users/Freyert/events{/privacy}","received_events_url":"https://api.github.com/users/Freyert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-08T17:01:14Z","updated_at":"2016-03-08T18:17:52Z","closed_at":null,"body":"Hey @jaredhanson ,\r\n\r\nLove `passport`, it's so nice having a single way of doing things. However, I'm running into issues because passport kills the middleware chain in a few cases. I've noticed this on errors, and redirects. This behavior is good for the novice because it protects them from some serious errors, but it really gets in the way after you've gotten your head around middleware.\r\n\r\nI'm guessing this all happens inside the default [`authenticate`](https://github.com/jaredhanson/passport/blob/master/lib/middleware/authenticate.js#L57) at the [`complete`](https://github.com/jaredhanson/passport/blob/master/lib/middleware/authenticate.js#L238-L251) function because it `returns` after calling `res.redirect` instead of going all the way down and calling `next()` which should be `return next()`. \r\n\r\nThis would be a gimongously backwards incompatible change and this _might_ be bike shedding on my part. And it seems like the good work around is to pass a `callback` to the `authenticate` function in order to steer custom functionality."},"comment":{"url":"https://api.github.com/repos/jaredhanson/passport-local/issues/comments/193898718","html_url":"https://github.com/jaredhanson/passport-local/issues/131#issuecomment-193898718","issue_url":"https://api.github.com/repos/jaredhanson/passport-local/issues/131","id":193898718,"user":{"login":"Freyert","id":449155,"avatar_url":"https://avatars.githubusercontent.com/u/449155?v=3","gravatar_id":"","url":"https://api.github.com/users/Freyert","html_url":"https://github.com/Freyert","followers_url":"https://api.github.com/users/Freyert/followers","following_url":"https://api.github.com/users/Freyert/following{/other_user}","gists_url":"https://api.github.com/users/Freyert/gists{/gist_id}","starred_url":"https://api.github.com/users/Freyert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Freyert/subscriptions","organizations_url":"https://api.github.com/users/Freyert/orgs","repos_url":"https://api.github.com/users/Freyert/repos","events_url":"https://api.github.com/users/Freyert/events{/privacy}","received_events_url":"https://api.github.com/users/Freyert/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T18:17:52Z","updated_at":"2016-03-08T18:17:52Z","body":"Well my use case is I want a log of all the In and Out from the server. If passport redirects without continuing the chain I won't be able to collect a record that I redirected that user. I use this pattern quite frequently as it eliminates the need to do inline logging."}}