express-mysql-session icon indicating copy to clipboard operation
express-mysql-session copied to clipboard

Delete record from table when user log out?

Open BadPistol97 opened this issue 4 years ago • 2 comments

How to delete the record in the table when user log out? if I am supposed to do so.

BadPistol97 avatar Apr 26 '21 04:04 BadPistol97

I was wondering that the other day. If I read the source code correctly, expired session records are deleted automatically every fifteen minutes, so you do not need to delete them yourself.

antefix-consulting avatar May 06 '21 23:05 antefix-consulting

In your application logic, you can delete the session of the active user when they logout. The express-session module adds the session ID to the request object of express as req.session.id. So in your logout route, you could delete the session row from your database using this session ID.

chill117 avatar May 28 '21 15:05 chill117

Closing this as it's likely been solved.

chill117 avatar Mar 16 '23 17:03 chill117