chill117 / express-mysql-session

A MySQL session store for the express framework in node
MIT License
313 stars 106 forks source link

some options don't work #149

Open PoBiRi opened 6 months ago

PoBiRi commented 6 months ago

'clearExpired', 'checkExpirationInterval', 'expiration' options don't works in my code how can i fixed it? it seems to need some privileges, what privileges need for these options?

const mysql = require('mysql');

const db = mysql.createConnection({
    host: 'localhost',
    user: 'host',
    password: '1234',
    database: 'pohub',
    port:'3306'
});

const sessionStore = new MySQLStore({
    clearExpired: true,
    checkExpirationInterval: 5000,
    expiration: 10000,
}, db);

app.use(
    session({
        httpOnly: true,
        secret: "hello",
        resave: false,
        saveUninitialized: false,
        store: sessionStore,
        cookie: {
            maxAge: 10000,
            sameSite: 'lax',
            /*secure: true,
            sameSite: 'none',*/
        }
    })
);
chill117 commented 5 months ago

How do you know these options don't work? What have you tried? What have you observed? What errors, if any, do you see in your logs?

PoBiRi commented 5 months ago

image when make session with this user account, data record doesn't disappear in my mysql database. but with my root account, there is no problem.