IBM Support

An IBM Worklight error occurs in authentication after the session has expired

Troubleshooting


Problem

An IBM Worklight client application tries to perform a custom authentication login by using the "j_security_check" submit path after the session has ended. However, the server does not recognize the protected resource that originally initiated the login form and returns a 404 status response to the client application.

Cause

The session ended because the session timed out, the server failed, or the server restarted.

Resolving The Problem

To resolve this issue, change the client application code to re-initiate the login procedure on the new session, by using the following code in the challenge handler:
j
sampleAppRealmChallengeHandler.isCustomResponse = function(response) {
    if (!response || response.responseText === null) {
        return false;
    }
    var indicatorIdx = response.responseText.search('j_security_check');

    if (indicatorIdx >= 0 && response.status != 404){
        return true;
    }  
    return false;
};

Because of the additional condition in boldface type, the client re-requests the original protected resource, which re-initializes the server authentication state. This re-initialization causes the server to resend the form to the client application. As a result, a second attempt to submit the login to "j_security_check" should now be successful.

For more information, see the product documentation. In particular, see the "Form-based authentication" Getting Started module that you can find in the "Tutorials and samples" topic, under category 8. Authentication and security.

[{"Product":{"code":"SSZH4A","label":"IBM Worklight"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Security","Platform":[{"code":"PF014","label":"iOS"},{"code":"PF005","label":"BlackBerry OS"},{"code":"PF003","label":"Android"},{"code":"PF034","label":"Windows Mobile"}],"Version":"6.1","Edition":"Consumer;Enterprise","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
19 August 2022

UID

swg21657868