Search code examples
ibm-mobilefirsthybrid

Mobile first Session Timeout call back function?


I'm implementing an adapter base authentication and trying the session timeout functionality in "worklight.properties"

Is there a callback function for serverSessionTimeout? I want to get go back to the login screen when this happens.

I'm only able to get a response is true in isCustomResponse meaning it will ask user to key in the login details (e.g. "credentialsRequired") again. In which I can't differentiate whether this is a first time login or session timeout.

https://www-01.ibm.com/support/knowledgecenter/SSHSCD_7.0.0/com.ibm.worklight.deploy.doc/admin/r_miscellaneous_settings.html


Solution

  • There is no callback for it. This needs to be handled in the same place in your code where you are checking for the user credentials.

    Meaning:

    1. Application launches > user reaches the login screen
    2. User log-ins (a request to a protected resource is made, a challenge is sent to the client, the check is for the adapter to process and verify user credentials for example, the response/reply to the check is sent to the server, the server approves, the client proceeds to display whatever is after the login screen
    3. A timeout is reached, the server knows this and sends a challenge again to the client

    In this same code piece, if a challenge is sent to the client, you need to ensure to change the client UI to display the login form.

    Basically I don't think you need to differentiate, but rather treat them the same?
    At least that's my interpretation/understanding.

    I think this is what is done in the adapter-based authentication sample application. Have you checked it?