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

Setting { session: false } doesn't seem to work #22

Open
yizhao opened this issue Jul 7, 2014 · 3 comments
Open

Setting { session: false } doesn't seem to work #22

yizhao opened this issue Jul 7, 2014 · 3 comments

Comments

@yizhao
Copy link

yizhao commented Jul 7, 2014

I have a node/express webapp with session setup. I use connect-mongo to store the sessions in mongodb, in a collection called 'sessions'. Hitting any rest endpoints on node/express seems to create/update an entry in the sessions collection.

Two questions:

  1. I only enforce the local strategy on the /login endpoint. Why does a session get created every time an endpoint is hit? If the user isn't logged in, why does a session need to be created?
  2. I implemented a new 'bearer' strategy. Configured it so session=false. passport.authenticate('bearer', { session: false }, function(err, user, info)

This still creates a session in the mongodb. Why is that?

@simonbs
Copy link

simonbs commented Sep 16, 2014

I have the same setup and get the exact same thing. Did you manage to find a solution to this, @yizhao?

@yizhao
Copy link
Author

yizhao commented Oct 23, 2014

@simonbs we got around this issue by adding a piece of middleware in express before the session stuff which checks if user is logged in or about to log in, if not, don't do all this session business.

@etcetc
Copy link

etcetc commented Apr 9, 2017

I have the same issue. The documentation specifies that one can set session:false and not establish a session, so is this then a bug?

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

3 participants