-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Remove need to call passport.initialize()
#875
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
Conversation
This shouldn't really be marked as a patch. |
Can you provide details? You shouldn't be getting that error, so there must be some other unexpected condition occurring. I'm confident that there should be no breaking changes here. |
To add to my rationale: The error string you mention, "passport.initialize() middleware not in use", is only present in the |
@RealDrewKlayman Can you provide a list of the strategies you use in your application? As discussed in #877, |
I am working on the same project as @RealDrewKlayman. Our package.json had It's possible that some interaction between these caused the problem, but the problem was resolved by changing our package.json to The project also includes passport-headerapikey@1.2.2 and passport-local@1.0.0. |
@jaredhanson I just read through #877 and that does appear to be the same problem we're experiencing |
Thanks for confirming @sonofole . I've published |
@jaredhanson Yes it appears to be working with 0.5.2, thanks for the quick fix! |
This PR continues the work started in #848, completing the refactor away from using
req._passport
.Following the patterns of other middleware, the HTTP request is now extended when it passes through
authenticate()
middleware, rather thaninitialize()
. This removes the need to usepassport.initialize()
entirely, which simplifies the app-level middleware stack. It should also make it easier to adapt Passport to non-Express web frameworks.