Dynamically modify Session Lifespan and update existing sessions. #3153
-
Hey ! We're running the self-hosted version of the Ory Kratos and we need the flexibility of modifying session lifespans. Is there a way to do this programmatically through an API similar to what's provided when using Ory Network? Currently, the only option is to edit the schema files and restart the instances so the changes in the schemas take effect. Moreover, would it be possible to bulk-update or bulk-expire user sessions when the lifespan is modified? After a few tests, I noticed that when the session lifespan is changed and the instances are restarted existing sessions are still active and under the effect of the old lifespan. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
The functionality in the Ory Network is the same as in self-hosted for this feature. What you're probably looking for is: https://www.ory.sh/docs/kratos/session-management/refresh-extend-sessions
I don't think we can add that - updating 100M+ rows on a config change can bring a system down :) |
Beta Was this translation helpful? Give feedback.
-
That's similar but it's not what I'm looking for. I want to modify the session lifetime via an API, so that when I change it, for example, from 30 days -> 7 days newly created sessions expire in 7 days instead of 30. In order to do that now I have to change Kratos config file and restart the service, I'm trying to avoid that because I need to change this programmatically.
Makes total sense. |
Beta Was this translation helpful? Give feedback.
-
I've noticed that if I restart kratos, all user sessions are logged out and they need to re-log in. is this expected? |
Beta Was this translation helpful? Give feedback.
The functionality in the Ory Network is the same as in self-hosted for this feature. What you're probably looking for is: https://www.ory.sh/docs/kratos/session-management/refresh-extend-sessions
I don't think we can add that - updating 100M+ rows on a config change can bring a system down :)