Questions tagged [connect-mongo]

100 questions
0
votes
2 answers

Node.js SPA, how to delineate between handling sessions for individual site visits(page refreshes), and long-term site visits (browser open/close)

I'm making a SPA with login functionality. I enacted session handling with 'express-session' originally so that the user's mongoDB _id would be stored, and they could hit 'refresh' without being logged out, which worked perfectly well. From here, I…
0
votes
1 answer

Can I use connect-mongo without Mongoose?

I'd prefer to use another ORM or just the core MongoDb driver. How hard would it be to make this possible? I'm currently using Monk, which is a light wrapper on top of Mongoskin.
Tim Hardy
  • 1,654
  • 1
  • 17
  • 36
0
votes
1 answer

How can i fetch particular session document by specific value in express session using connect mongo?

Am trying to fetch all session document based on user id so that i can redirect after they are successfully logged in any machine by storing the variable named like lastviewed and date in session document, Please guide me further am using…
0
votes
0 answers

Mongoose keeps trying to authenticate with wrong admin db even though it is specified

The initial connection to the database seems to authenticate fine with this: mongoose.connect('mongodb://user:pass@localhost/traderdb/?authSource=admin', { auth: { authdb: "admin" } }, function(e) { //other…
Chris Hansen
  • 315
  • 1
  • 3
  • 12
0
votes
0 answers

Nodejs/Express Session - Error: Can't set headers after they are sent

I am getting the below error while trying to use express session with a simple nodejs sample app. When "resave" is set to true the below error appears, however when the same is set to false, there is no error. GET / 304 13.380 ms - - Error: Can't…
user3868848
  • 133
  • 2
  • 10
0
votes
1 answer

My Node.js web app establishes new session every time I reopen the browser

Every time I close all the browser windows and then open the web app again, a new session is established, that means I have to authenticate again. For your reference, I use express@4.14.0 as the web application framework, express-session@1.14.1 +…
kitlee
  • 110
  • 8
0
votes
1 answer

Ended sessions are not being destroyed

My application is using connect-mongo, express-session, keystone and passport handling login and user sessions. However, when a session ends (user logs out or closing the browser window) the session is not removed from the MongoDB session…
ChrisRich
  • 8,300
  • 11
  • 48
  • 67
0
votes
1 answer

set-cookie field is present, however is not set in Resources/Application tab of the browser

I got a cookie being set in the response header, however my browser doesn't store the cookie. The front-/back-end components run on localhost:8080/8082 respectively. Using node v5+, express v4+ and tried both connect-mongo/connect-redis Chrome v.…
Nikolay Melnikov
  • 1,395
  • 1
  • 15
  • 25
0
votes
1 answer

How to configure connect-mongo

I am using "connect-mongo" node module to store session data in mongodb. Below is my code related to configuring connect-mongo const cookieParser = require('cookie-parser'); app.use(cookieParser()); const session = require('express-session'); const…
refactor
  • 13,954
  • 24
  • 68
  • 103
0
votes
1 answer

ExpressJS / connect-mongo update session

I'm using connect-mongo to store PassportJS sessions. My conf in server.js is: app.use(session({ name: 'Example', secret:'exampleasd', saveUninitialized: false, resave: false, cookie: { maxAge: 1000*60*60*2 }, store: new…
mdv
  • 925
  • 3
  • 14
  • 28
0
votes
1 answer

Prevent html rendering from a non-browser GET request

Im currently using Node & Express to build my application My authentication function looks like this: exports.isAuthenticatedLocal = function(req, res, callback) { // console.log(req.headers); if (req.isAuthenticated()) { …
Sanction
  • 179
  • 1
  • 2
  • 10
0
votes
2 answers

Connect-mongo Error: Cannot find module 'mongodb/node_modules/bson'

Before of write this question I was reading other ones about almost the same error but that questions are from 2013-2014, and the solutions doesn't work, I'm using ElementaryOS (Ubuntu 14.04). I want to manage sessions on my nodejs app which will be…
Hugo Sanchez
  • 1
  • 1
  • 2
0
votes
1 answer

express-session and connect-mongo setup

I'm using express-session and am now wanting to use connect-mongo to persistently store session. I have seen the docs and some tutorials and mostly understand how it works, but I assume you need a mongoDB instance setup in the first place so…
mindparse
  • 6,115
  • 27
  • 90
  • 191
0
votes
2 answers

Whenever i restart sails server session got expired how to save session in database?

from past two days i am facing this problem. whenever i restart my sails server session got expired and all users got logged out. Is there any way to overcome from this ? I have gone through the sails doc but not successful to save the session in…
Ankur
  • 51
  • 4
0
votes
1 answer

connect-mongo: unserialize: options.unserialize || (x => x), SyntaxError: Unexpected token >

it's run well in the windows, but has the problem in ubuntu. root@tegra-ubuntu:/home/ubuntu/pt/nodejs/new# node --harmony app.js /home/ubuntu/.local/share/Trash/files/new/node_modules/connect-mongo/src/index.js:28 unserialize:…
Qiang Yu
  • 27
  • 4