How can I find the session Id when using express / connect and a session store?

前端 未结 4 632
星月不相逢
星月不相逢 2021-01-31 16:55

If a user is already logged in and tries to login again in a new instance I\'d like it to log out the other user instance. I don\'t want the same user to be logged in twice on m

4条回答
  •  渐次进展
    2021-01-31 17:12

    Question: Is it possible to query Redis to obtain the session id based on the username?

    No. The session keys in redis are not named after the username.

    Here's a thought, though: When an already logged in user tries to login again, can't you see that, in your application, and either destroy the old session immediately, or not allow them to login again?

提交回复
热议问题