bnoguchi/everyauth — pull request #193 by RandomEtc (2012-02-26 23:55:39+00:00)
Title: Add `next` to the accepts parameters for appropriate oauth and oauth2 steps

Two main changes:

- apply @quickredfox's [fix](https://github.com/bnoguchi/everyauth/issues/36#issuecomment-2433430) which correctly passes `seq.values` to `moduleErrback` when promises fail
- add `next` as a parameter to steps that currently take `req res` already in oauth/oauth2, reasoning that if they are allowed to write to `res` they should also be allowed to pass control (especially errors) to `next` ... this is following through on my comment at #173, which also addresses related issues and makes `next` available everywhere, but with more modifications to everyauth's internals.

By adding next as a named parameter it becomes available in the extra `seq.values` passed to each step, and @quickredfox's fix means that those values are now available in `moduleErrback`. Using those extra values was @bnoguchi's proposed fix to error handling issues in #36 but the issue was reopened because of the problem with failing promises not getting access to the required arg.

All this means that when control reaches `moduleErrback` in an oauth/oauth2 module after a promise fails we are able to respond to the user by passing an error to `next()`. Previously our failed requests would just hang/timeout.