-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Singleton behavior not in documentation #402
Comments
What was the unexpected behavior? What difference would it make to pass an exported instance around, as opposed to an instance your application constructed? |
Sorry, I meant that passport was working properly, but we had actually misconfigured our app and couldn't figure out how it was be working (we were adding our strategies to what we thought was a new passport instance in a separate file). To be clear, the only issue I'm reporting is that the singleton behavior isn't in any of the documentation. |
Noted. I've got it on my backlog to update the documentation. When that gets to the top of the list, I'll make sure this is clarified. Thanks. |
Also, this should be here: https://github.com/passport/www.passportjs.org ? |
@Kinnardian I wasn't sure if it was "encouraged" enough to put it on the standalone site versus in the README.md of this repo. |
I just wanted to add that I had to look at the source code to figure out how to create multiple instances of Passport for testing purposes. Wasn't too big of a deal, but +1 for a note in the docs. Keep up the great work! |
So how is it possible to create multiple instances of passport? Can we just do new Passport? I have different strategies on the same app used for entirely different things. |
var passport = require('passport'); // default instance of passport
// to make a new one just do
var secondInstancePassport = new passport.Passport(); |
The fact that Passport exports a singleton by default and has a constructor if you need multiple instances only seems to be documented in the response to issue #27.
It would be helpful if that information was in the official documentation. When I set it up on a project, I was passing the returned object around because I hadn't seen that it was a singleton (and resulted in some unexpected behavior until finding that was the case).
The text was updated successfully, but these errors were encountered: