Extend Session Timeout

🧭 Overview - extendSessionIdleTimeout API

The extendSessionIdleTimeout API allows the mobile application to manually extend the user's session timeout, helping prevent unexpected session expiry due to inactivity. Once called, the SDK will emit the onSessionExtensionResponse event indicating success or failure of the operation.


🎯 Purpose

To extend the session's idle timeout and keep the user logged in without them needing to reauthenticate due to inactivity.

Use this when:

  • A long-running task is in progress (e.g., form filling, scanning).
  • Preventing session timeout during background activity or network wait.
  • Keeping the session alive while showing information pages.

📱 UI Guidance

This API should be called silently in the background. The user interface should only react to the event onSessionExtensionResponse if failure occurs, e.g., by prompting the user to reauthenticate.


🔁 API Details

Method Signature

PlatformMethod
React NativeRdnaClient.extendSessionIdleTimeout(callback)
FlutterrdnaClient.extendSessionIdleTimeout()
Cordovacom.uniken.rdnaplugin.RdnaClient.extendSessionIdleTimeout(...)
Native AndroidRDNAError extendSessionIdleTimeout()
Native iOS[client extendSessionIdleTimeout]

🔁 Event: onSessionExtensionResponse

The onSessionExtensionResponse event is triggered by the REL-ID SDK in response to a session extension attempt. This event occurs after the app calls the extendSessionIdleTimeout() API, allowing the session to stay active without requiring the user to re-authenticate.


🎯 Purpose

To inform the application of the result of a session extension request, which is typically used to prevent auto logout due to inactivity.


📱 UI Guidance

Typically, no UI is needed. However, apps may optionally show feedback such as "Session extended" or alert the user in case of failure.


✅ Success Payload (Sample)

{
  "status": {
    "statusCode": 100,
    "statusMessage": "Session extended successfully"
  },
  "error": {
    "shortErrorCode": 0,
    "longErrorCode": 0,
    "errorString": "Success"
  }
}

❗ Failure Payload (Sample)

{
  "status": {
    "statusCode": 400,
    "statusMessage": "Extension failed"
  },
  "error": {
    "shortErrorCode": 131,
    "longErrorCode": 5001,
    "errorString": "Biometric Cancelled"
  }
}

🧩 Payload Fields

FieldDescription
statusCodeHTTP-like code indicating the result
statusMessageHuman-readable status
shortErrorCodeSDK-specific error code
errorStringDescription of the error

❗ Error Handling

Common Errors

Short CodeError EnumDescriptionAction
4RDNA_ERR_INVALID_ARGSInvalid arguments providedFix parameters and retry
52RDNA_ERR_FAILED_TO_OPEN_HTTP_CONNECTIONNetwork errorRetry after backoff
131RDNA_ERR_STEPUP_AUTH_LDA_BIOMETRIC_CANCELLED_BY_USERUser cancelled biometricPrompt user to retry

✅ Developer Action

On Success

  • No user action is needed. Continue using the SDK APIs. Resume session activity as normal.

On Failure

  • Show an alert or logout the user based on app’s session policy.

💻 Sample Code (Platform-Specific)

React Native
rdnaEventRegistery.addListener('onSessionExtensionResponse', (response) => {
  if (response.error.shortErrorCode === 0) {
    console.log("Session successfully extended.");
  } else {
    console.error("Session extension failed:", response.error.errorString);
  }
});
Flutter
rdnaClient.on(RdnaClient.onSessionExtensionResponse, (String response) {
  final data = jsonDecode(response);
  if (data['error']['shortErrorCode'] == 0) {
    print("Session extended.");
  } else {
    print("Failed to extend session: ${data['error']['errorString']}");
  }
});
Cordova
document.addEventListener("onSessionExtensionResponse", function(event) {
  if (event.error.shortErrorCode === 0) {
    console.log("Session successfully extended.");
  } else {
    console.error("Failed to extend session:", event.error.errorString);
  }
}, false);
Native Android
void onSessionExtensionResponse(RDNARequestStatus status, RDNAError error) {
  if (error.getShortErrorCode() == 0) {
    Log.d("REL-ID", "Session extended");
  } else {
    Log.e("REL-ID", "Session extension failed: " + error.getErrorString());
  }
}
Native iOS
- (void)onSessionExtensionResponse:(RDNARequestStatus *)status error:(RDNAError *)error {
  if (error.shortErrorCode == 0) {
    NSLog(@"Session extended");
  } else {
    NSLog(@"Failed to extend session: %@", error.errorString);
  }
}