I too cannot get session extension to work I am ru...
# ory-selfhosting
s
I too cannot get session extension to work I am running kratos 1.1.0, I can call the extension API ok, If i query kratos using the admin API it shows the session has a new expiresAt time, I return a new cookie to the UI with the new MaxAge, but when the old expiry time is reached, and my middleware calls the public /sessions/whoami API in kratos I get: [ debug: message:request does not have a valid authentication session reason:No active session was found in this request. status:Unauthorized status_code:401 ] is there any further digging I can do or is it time to run kratos under the debugger?
c
Saw some ppl here fixing stuff by building the kratos docker image from Dockerfile. Maybe faster/easier than going down the dbg rabbithole
Especially because even if you find the bug and fix PRs may be brushed off...
s
I am still trying to understand the issue. It looks to me (from a position of not really understanding their code) that a session cache entry in memory is deleted at the old expiry time, even though the back end database has been updated with the new session expiry time. So I think debugging (or at least printfs) is the way forward. I just about have kratos building and running on the command line - I have a lot of environment to configure.
I am checking the user account is active (it is) and the session is still marked as active (it is) The problem appears to be ManagerHTTP.getCookie() which looks up cached sessions by cookie is failing to find the session.
I am now wondering if it is the way I am implementing the session extension that is the problem. I think the extension api returns a new cookie with different maxAge / expiresAt times but I ignore this. The Cookie my UI uses has no maxAge but perhgaps because I don't present this new cookie to kratos its cache is not updated. i.e. they expect the cache to be updated by a roundtrip to the user?
I understand. the call to ToSession() can return a refreshed cookie in the 'resp' return field - This should be forwarded to the UI. This only happens after extending a session.