As per my client requirement I have to implement auto logout on Session timeout. To Implement this I have created a timer on client side which for every minute checks if user is still authenticated. If user is not authenticated then display message and route user back to login page.
So I set up my application is Session dependent mode. I have updated worklight properties like this.
mfp.session.independent=false
mfp.attrStore.type=httpSession
serverSessionTimeout=10
I have also update authenticationConfig.xml where I have set expirationInSeconds As mentioned in this (documentation) https://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.dev.doc/devref/r_configuring_login_modules.html
<loginModule name="CustomLoginModule" expirationInSeconds="-1">
I read couple of other threads and found that every minute I can call WL.Client.isUserAuthenticated("MyReleam") and check if user is still logged in. There is issue with this method it does not sync with server so we are suppose to call WL.Client.updateUserInfo() first which will sync the user identity with server then check for authentication, but it brings another issue with session time out.If every minute I call WL.Client.updateUserInfo() it will extend my session. So basically session will never time out if I keep checking every minute.
Can any one help me to know how can I achieve this functionality? Which method should I use to check if user is still authentication or session is timed out or not.