How to use passport with express and socket.io?

前端 未结 3 1420
别跟我提以往
别跟我提以往 2020-11-28 01:28

I am currently trying to set up a basic authentication system for my node.js app. For now I am using express (3.0.0rc5), passport (0.1.12) and socket.io (0.9.10) with Mongoo

3条回答
  •  有刺的猬
    2020-11-28 02:23

    You can make use of express-socket.io-session. You can get the passport session user with socket.handshake.session.passport.user . It supports both reading and writing to the session store.

    NB: Works with express > 4.0.0 and socket.io > 1.0.0 and won't be backward compatible

提交回复
热议问题