title: Why req.session saved in sessionStore and How to access value from sessionStore
body: <p>I am using express + passport.js in node.js.
  And wants to secure my RestAPI. I have set the token in session as:</p>
  
  <pre><code>saveUser = function (req, res) {  
  User.findOrCreate({ user_id: req.body.user_id, user_name: req.body.username })
       .success(function(result){
         req.session.token = 'dfgsfd4g564fg456d4gsgsdfg4';
         res.send({status:"ok"});
       }).error(function(error){
           res.send(error);
       }); };
  </code></pre>
  
  <p>but this is set in req.sessionStore.sessions why.?
  and every time  key is changed so how to access token from req.sessionStore.sessions.?</p>
  
  <pre><code> sessionStore: 
     { sessions: { E8DRcn3lWkTfAJb3FsPnoeaF: '{"cookie":{"originalMaxAge":null,"expires":null,"secure":true,"httpOnly":true,"path":"/"},"passport":{},"username":"testing.user","token":"3iqZ31YdUaTtyvI6"}' },
       generate: [Function],
       _events: { disconnect: [Function], connect: [Function] } },
    sessionID: 'Ykl9ONPvbxsTOa9Fonb6GFEP',
    session: 
     { cookie: 
        { path: '/',
          _expires: null,
          originalMaxAge: null,
          httpOnly: true,
          secure: true },
       passport: {} },
  </code></pre>
  
  <p>This configuration in my app.js file.</p>
  
  <pre><code>app.configure (function () {
    app.use (express.cookieParser()); 
    app.use (express.bodyParser ());
    app.use (express.methodOverride ());
    app.use (express.session({ secret: 'secret_code' })); // session secret
    app.use (flash());
    app.use (express.json());
    app.use (passport.initialize());
    app.use (passport.session());
    app.use (express.static(path.join(__dirname, 'public')));
    app.set ('view engine', 'ejs');
    app.use (app.router);
  });
  </code></pre>
  
  <p>Thanks in Advance.</p>