sessions icon indicating copy to clipboard operation
sessions copied to clipboard

How to set different MaxAge for cookie and store(redis)

Open shinolex opened this issue 1 year ago • 0 comments

Hello,

I want to set MaxAge to 0 for expiration time in browser side but I want to give another MaxAge for my redis store. Is it possible to do it? So far I've tried this store.Options(sessions.Options{MaxAge: 0}) before I make r.Use call as mention here

When I set MaxAge to 0 it works on browser side, it creates the cookie with expiration time "session" but the session info does not get stored in Redis.

My goal here is, force the user to login everytime he enters the website for the first time and keep the session open as long as he don't close the browser. Once he closes it the old session will be dropped from browser and from redis after 10 days.

shinolex avatar Oct 27 '22 11:10 shinolex