gin-contrib / sessions

Gin middleware for session management
MIT License
1.46k stars 196 forks source link

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

Open shinolex opened 2 years ago

shinolex commented 2 years ago

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.