I implemented sessions using Passport , but to store sessions I tried connect-mongo using mongoose . p>
This is my code (part of the session):
var express = require('express') var mongodb = require('mongodb') var mongoose = require('mongoose') var bodyParser = require('body-parser') var cookie = require('cookie-parser') var connect = require('connect') var passport = require('passport') //var flash = require('connect-flash') var session = require('express-session'); var MongoStore = require('connect-mongo')(session); var LocalStrategy = require('passport-local').Strategy; var app = express() var BSON = mongodb.BSONPure app.use(express.static(__dirname+"/public")) app.use(bodyParser()) app.use(cookie()) app.use(connect.session({ secret: 'ilovescotchscotchyscotchscotch' })); app.use(passport.initialize()); app.use(passport.session()); mongoose.connect('mongodb://localhost/psicologosTuxtepecDB') var Schema = mongoose.Schema var userCredential = new Schema({ username: String, password: String }, { collection: 'members' }) var userCredentials = mongoose.model('members', userCredential) app.use(session({ secret: 'ziKologiia', clear_interval: 900, cookie: { maxAge: 2 * 60 * 60 * 1000 }, store: new MongoStore({ db : mongoose.connection.db }) }));
Something I doubt would be counterproductive that the module app.use(connect.session({ secret: 'ilovescotchscotchyscotchscotch' })) is using connect, but the MongoStore configuration is set to the express-session variable. However, removing the first reason does not work well (will not authenticate / redirect).
So, about my question title. Where is this session stored? I really thought I could go to my Mongo database and find any collection that stores it.
How can I find such sessions in the backend (Mongo) and even when using Java Script objects?
source share