简体   繁体   中英

How to use traditional sessions in Feathers js

Feathers auth provides only JWT authentication, even if strategy is local. Should I make full custom middleware for express-session usage and clean passport implimentation just to achive regular sessions behaviour or there's some solutions for this purpose?

Also, I want to use passport.socketio for autheticate sockets aswell.

Using Feathers authentication module is entirely optional and you can always register your own middleware at any point like before and after a service . This means you can set up a normal Express session setup and then set req.feathers to the information from the session that you also want to pass to Feathers services (like the user). As you mentioned, you will have to do the same thing with websockets (which also allow setting handshake.feathers in its middleware).

A full tutorial how to set up sessions and using authentication can be found in the Using A View engine cookbook documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM