session icon indicating copy to clipboard operation
session copied to clipboard

session regeneration

Open zubairhamid opened this issue 10 years ago • 3 comments

some method definition is required for reset/regeneration of session. if any please inform.

zubairhamid avatar Feb 23 '15 11:02 zubairhamid

Why not fix this issue? Could someone give a comment? cause I found it's easy to do.

palmtale avatar May 04 '17 14:05 palmtale

I also wonder about this. How can I re-create the session? I want to logout current user just before logging in the new one:

// if some user is already logged in destroy his session
if (!ctx.session.isNew) {
   ctx.session = null;            
}    
// login
ctx.session.userId = userId;

Can't getter create new session automatically if necessary?

I tried to do it like this:

ctx.session = null;
await KoaSession(ctx.app).call(this, ctx, next);

But it will throw TypeError: Cannot redefine property: sessionOptions

urugator avatar Nov 25 '17 22:11 urugator

Not sure if this has been added, but I can't find a reference in the docs. I also have the same use case of destroying/recreating a session in a single call.

ethanpollitt avatar Feb 26 '19 21:02 ethanpollitt

@fengmk2 with #221 merged, this can be closed now. 🎉

lehni avatar Feb 04 '23 15:02 lehni