hello - has anyone had any luck dynamically settin...
# ory-selfhosting
d
hello - has anyone had any luck dynamically setting Kratos session durations? For example, you have 2 classes of user (admin and user), and you want the admin session lifetime to be 24 hours, but the regular user to be 30 days (this is just an example). I have tried a flow interrupting after-login webhook to change the expires_at property of the session, but this is ignored by Kratos.
/admin/sessions/{id}/extend
will not work for this use case because it doesn't have any flexibility to set an expiration. I see that Enterprise allows you to configure session durations per organisation, which still isn't exactly what I want, but are the building blocks there in Kratos Open Source?
b
You could protect your admin routes to behave like "privileged sessions" you just need to check the authenticated_at in the session. If its greater then 24 hour send the user back to login with
?refresh=true
d
hey thanks. Yes that's I think the only workaround, just have our API enforce the session length, rather than Kratos