Check session expired with javascript


#1

Hello,

I want to be able to check if a user session has expired, and show them a warning/prompt to log in again.

My application consists of some long forms, and sometimes users complain that by the time they try to submit them, it fails because the session has expired. (they usually leave the page on for long amounts of time).

Thanks


#2

I guess you’ll need to run a background query?

Note there’s no way currently to distinguish between a new user or a timeout:


#3

Yes, I plan to add an AJAX check every X seconds.
Not sure how to get user the session info though.
Just need to know if the user is still logged in, or not.


#4

If you request any json query, which would be behind an authGuard, you would receive some kind of exception.