How to handle 401 due to inactivity or user logs out from other window

Hello

We have simple application page with custom widget that uses typeahead with http to fetch data. Everything works great as long as session is valid. However typeahead stops showing results (as expected) after 401 but UI remains same.

Browser source changes html page back to login form after 401 but doesn’t refresh on its own. As a result user is not informed about invalid session.

Any suggestions how to handle this issue.

Regards
KB
Bav Systems

Maybe a possible solution would be to handle the 401 HTTP response code in your custom widget and trigger a refresh of the page that will redirect the user to the login page.

Or you can maybe include a custom widget that will do some dummy API call to keep the session alive.
According to https://documentation.bonitasoft.com/bonita/7.9/user-authentication-overview default session duration is one hour, so you just need to make sure a call is done every 59 minutes to keep the session alive.

Thanks a lot for your reply. I like your second approach of keeping session alive.

Regards
KB