node.js - Passport.js session management without cookie -


i'm pretty new node world. have looked around few days, , can't find way existing npm "official" solutions. if there apologies, i'll better in finding right node resources.

i have implemented working passport local policy following various examples available on internet. works well

i want implement session management, don't want use cookies , use get/post parameters instead. reason behind i'm building api service might have work custom protocols (other http) cookies/headers don't exist.

i have seen sessions support implementation passport , seems rely on express/connect session package, that, in turn, seems support cookie , have no way read/write sessions key in post/get parameters.

before roll out own bespoke solution, point me available, if exists?

so can this.

passport.js uses npm express-session middleware actual session infrastructure.

since express supports pipelined arbitrary middleware managed use following workaround:

  1. in express setup, add middleware function before express session middleware.

  2. in middleware function, check see if session token/id exists on request (as header or in body required) , if so, read the session token/id it.

  3. set session token/id onto request.cookies object (if you're using cookie-parser) and/or append serialised cookies in headers: request.headers.cookie += ...my new cookie goes here...

  4. make sure name cookie after name pass express-session

express-session should able pick off request resuscitation.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -