Prolong and/or restore frontend user session

i have a frontend that does login a kirby user using uniform login. once logged in all communication is done using ajax and api calls. these calls check if a user is logged in and do call $page->updates or upload files.

once in while a user is disconnected earlier than the expected session timeout. as far as i understand the sessions logic based on forum threads this could happen of switching IP etc.

my problem with that is that my frontend does not notice that until api calls start to bounce.

is there a way to prolong the session without big overhead? can i just call user->login() again every 30sec?
any suggestsion how to recover from a lost session – maybe like an triggered auto-login-page-refresh feature?

when using site()->user()->login() from my frontend the panel.session.timeout setting is applied, right? what unit is that anyway? minutes?

https://getkirby.com/docs/cheatsheet/options/panel-session-timeout

It’s minutes, yes. Unfortunately I don’t have an answer for the other questions. I guess your users don’t have Panel access?

Edit: for frontend, see this post: Login session lifetime extending for the frontend

1 Like