flask-session2
flask-session2 copied to clipboard
Redis session cookies not supported?
It seems only permanent sessions (SESSION_PERMANENT=True) are supported for redis. Looking at the implementation:
if session.permanent:
value = self.serializer.dumps(dict(session))
self.redis.setex(
name=self.key_prefix + session.sid,
value=value,
time=total_seconds(app.permanent_session_lifetime),
)
This is the only place any values are set in redis.
When attempting to use session cookies (SESSION_PERMANENT=False), upon login this results in a state mismatch error, since the state was not written for later comparison. Session cookies work fine with memcached.
Is there a reason that session cookies are not supported for redis? It seems redis is the only implementation with this logic that checks "session.permanent" before writing a value to the respective cache.
Thank you