Stormpath - triggering warning before ending session due to inactivity

53 views Asked by At

I am having trouble finding information on how to go about triggering a warning prior to logging a user out due to inactivity. I am using express and stormpath in nodeJS.
Anyone have any advice on where to start with this issue?
Thank you

1

There are 1 answers

0
robertjd On

I work at Stormpath and I should be able to help.

You’ll need to use setInterval in the browser, and periodically check to see if the session is getting close to ending. You’ll need to start this poller on every page that needs to show the message. The poller will need to know how much time is left on the session. Because we don’t expose our cookie data to the browser (for security purposes) you’ll have to send this timeout information from the server to the browser, when the page is rendered. The server can know how much time is left by looking at the “expires” value of the incoming stormpathSession cookie.

Hope this helps!