Forum Discussion

smeyer012's avatar
smeyer012
Contributor
5 years ago

log out warning

We are hoping to trigger a pop up to warn a user when they've been logged out (due to inactivity) or are soon to be logged out.

Is there a hook or some way to access server data related to user timeouts?

-Stephanie

  • Did not try any of this myself (so take it with a grain of salt), but few approaches I'd try out would be:

    1) Check if you can identify the session cookie that should be set by either Khoros or your SSO, does it have an expiration date/time? If so, that could be read with JavaScript and then you could react appropriately when it expires.

    2) Pretty sure there is a "session" endpoint in the API somewhere (would need to dig trough the docs, I'd start with API v1!), just not sure what exactly it returns, but I can imagine it would tell you if you are still authenticated.

    3) the most ugly and "hacky" version would simply be to periodically request a page that only logged-in users can see...if you get a 40x error back from the AJAX request, you're probably logged out =D...but yeah, I wouldn't really recommend that one...