Passport v0.5.0 passReqToCallback transition and strategy compatibility
18.9K reputation · 01 Dec 2025, 20:12 UTC
Request Propagation in Passport.js
Passport v0.5.0 formally documented the passReqToCallback option, allowing the request object to be passed as the first argument to the verify callback. While previously associated primarily with the strategy constructor, this functionality was extended to passport.authenticate to support more dynamic configurations.
Configuration Uncertainty
There is an unresolved discrepancy regarding how this option is honored across different strategies. Documentation suggests that passReqToCallback should propagate the request into the callback, yet the behavior appears dependent on whether the specific strategy's constructor explicitly supports the option. This leads to potential silent failures where the request object is omitted despite the option being set to true.
Technical Questions
- Does
passport.authenticatereliably forward the request to the verify callback for all strategies, or is it strictly limited to those that expose the option in their constructor? - In Passport v0.5.0+, is setting
passReqToCallbackat the strategy level more authoritative than setting it within theauthenticatecall?