Closed AakashGfude closed 6 months ago
Did you load session using load_session
or use SessionAutoloadMiddleware
?
Also, session backend has to return bytes
, not dict
. Sorry, docs are outdated.
async def read(self, session_id: str, lifetime: int) -> bytes: ...
It's working now. Thanks. I was loading the middleware before SessionAutoloadMiddleware. I can get the session data in request.session
now.
I have made a custom store that stores user information decoded from a token in the database.
Baiscally the code looks like:
Now, I would have imagined that whatever is returned from
read
function will be stored in request.session? But I only get an empty object when accessing request.session in subsequent middleware. How to store the data in the session? Let me know if you have any ideas.Thank you,