Skip to content
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

Open
shawnpwalsh opened this issue Aug 27, 2015 · 8 comments
Open

Singleton behavior not in documentation #402

shawnpwalsh opened this issue Aug 27, 2015 · 8 comments

Comments

@shawnpwalsh
Copy link

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).

@jaredhanson
Copy link
Owner

What was the unexpected behavior? What difference would it make to pass an exported instance around, as opposed to an instance your application constructed?

@shawnpwalsh
Copy link
Author

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.

@jaredhanson
Copy link
Owner

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.

@Kinnardian
Copy link

Also, this should be here: https://github.com/passport/www.passportjs.org ?

@shawnpwalsh
Copy link
Author

@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.

@neodon
Copy link

neodon commented Oct 9, 2015

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!

@pronebird
Copy link

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.

@bjrmatos
Copy link

bjrmatos commented Mar 3, 2016

@pronebird

var passport = require('passport'); // default instance of passport

// to make a new one just do
var secondInstancePassport = new passport.Passport();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants