Deployed express server isn't creating a session?

I have deployed a node express server on digital ocean. However, it won’t create the session once it’s deployed. I added a store to prevent memory leak and initialized app.set('trust proxy', 1), before the session. I am creating a user for the session once the user is authenticated. The snippet below shows the configuration for the session.

        key: "userid",
        secret: "subscribe",
        resave: false,
        saveUninitialized: false,
        store: sessionStore,
        cookie: {
            expires: 60000 * 60,
            domain: ""

app.get("/login", (req, res) => {
    if (req.session.user) {
        res.send({ loggedIn: true, user: req.session.user })
    } else {
        res.send({ loggedIn: false })

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer