connect-mongo cross-domains session issue

176 views Asked by At

I am having a problem with sessions across sub-domains

I use connect mongo like so:

app.use(session({ // req.session is populated
        secret: 'xxxxxx',
        saveUninitialized: true,
        resave: true,
        store: new MongoStore({
            db: 'nnn'
        }),
        cookie: {
            path: '/',
            maxAge: new Date(Date.now() + time),
            domain : 'mydomain.com' ,
            httpOnly: true
        }
    }));

However, when I redirect to a subdomain xyz.mydomian.com the session is invalidated. Can anyone recommend a strategy for getting cross domain login to work with connect-mongo ?

0

There are 0 answers