7

I have a complex web app, which is working fine in desktop browsers, as well as in the Android native browser (which is part of why I got so long into this project before noticing this problem). The server setup is using the Typesafe Stack (Play/Akka/Scala), but I suspect that's not relevant to the question. Suffice it to say, it uses bog-standard transient session cookies to keep your login.

The problem is, in Chrome and Safari, that transient session appears to be too fragile, and very unpredictably so. In both cases, so long as I am working actively in the browser, everything is fine. But if I switch away from the browser for a while and return to it, it often loses the session cookie, forcing a re-login. Sometimes it takes an hour or two, sometimes just a few minutes -- I haven't yet been able to figure out a pattern.

Note that this doesn't involve closing the tab with my app in it, or manually closing the browser process. I would expect to be able to switch away from Chrome and come back to it using the app switcher and still have my session there; for some reason, though, it seems to be frequently and quickly losing the session cookie. This is a killer problem: users shouldn't be forced to re-login too often.

Any ideas or pointers to why these browsers might be losing their session cookies so easily? I've done lots of web development, but this is my first time seriously targeting mobile browsers, and I'm clearly missing something...

Justin du Coeur
  • 2,699
  • 1
  • 14
  • 19
  • 1
    Did you get anywhere with this? I'm having this problem too in Chrome/Safari mobile. I haven't tried to set a longer lived cookie though. I have behaviour whereby a second tab is opened, it has no memory of the session, but another tab does remember where it was, even when refreshing. It seems pretty unpredictable. – Luke Feb 11 '15 at 07:36
  • No -- I've done lots of experiments, but haven't come up with anything clear. My current plan is to switch over to persistent cookies as the default, with the usual "Remember Me" checkbox on login... – Justin du Coeur Feb 12 '15 at 13:03
  • I know this article is very old, but I have a weird problem, I use SQL for my sessions with expires in 365 days in a project with .net 6, the problem is everything is alright on my laptop with chrome and firefox browser, but in my android mobile, sessions lost every few hours, any solution? – Sepehr Estaki Aug 09 '22 at 18:36

0 Answers0