onUserLoggedIn

📲 onUserLoggedIn Event

🧩 Overview

The onUserLoggedIn event indicates that the user has successfully completed login via REL-ID, and a secure session has been created. This includes:

  • User authentication success (biometrics, password, OTP, etc.)
  • Device checks passed
  • JWT token issued
  • Session ID generated

🔒 This is a critical event used to transition into an authenticated app state.


🖼️ UI Requirement

App developers must:

  • Present a welcome screen, main dashboard, or select-group UI (for agent-based login).
  • Optionally extract and securely store userID, sessionID, and JWT for subsequent API usage.

🔗 Related APIs (Leading to This Event)

  • setPassword
  • setUserConsentForLDA
  • performVerifyAuth
  • activateUsing
  • setActivationCode

These API calls are typically invoked during:

  • Activation
  • Login
  • Additional device registration

🔔 Automatically Triggered SDK Events After Login

EventDescription
onCredentialsAvailableForUpdateIndicates credentials (e.g. password, secret questions) that the user may update
onUserEnrollmentResponse (if relevant)Confirms enrollment if applicable
Any pending post-login API response eventsE.g. onGetNotifications, etc.

🧪 Sample Payload

{
  "userID": "testuser",
  "challengeResponse": {
    "status": {
      "statusCode": 100,
      "statusMessage": "Success"
    },
    "session": {
      "sessionType": 1,
      "sessionID": "PBWFI2BFK9EH4YWEKXB7Z4VOVR7I7PF1CD5F067IXXFJCUMV..."
    },
    "additionalInfo": {
      "DNAProxyPort": 65535,
      "isAdUser": 0,
      "jwtJsonTokenInfo": "{\"access_token\":\"<JWT_TOKEN>\"}"
    }
  },
  "error": {
    "shortErrorCode": 0,
    "errorString": "Success"
  }
}

📦 Field Breakdown

FieldTypeDescription
userIDstringID of the user who logged in
challengeResponse.status.statusCodeint100 for success
session.sessionIDstringToken identifying session
additionalInfo.jwtJsonTokenInfostring (JSON)JWT access token details
DNAProxyPortintLocal port for DNA proxy, if applicable
error.shortErrorCodeint0 = success; see error handling for others

❗ Error Codes & Developer Actions

Error CodeMeaningDeveloper Action
0SuccessShow success screen, proceed
88SDK already initializedTerminate & reinitialize
116Invalid user configurationShow error, contact admin
126User is inactiveGuide user to reactivate
127User is blockedBlock access, suggest contacting admin

✅ Developer Responsibilities

On SuccessOn Failure
Cache session ID & JWT (securely)Display user-friendly error
Navigate to home or main dashboardRetry login if recoverable
If agent-based login, prompt group selectionBlock or redirect user if locked

💻 Code Snippets (Platform-Specific)

🔹 React Native
let onUserLoggedInSubscription = rdnaEventRegistery.addListener(
  'onUserLoggedIn',
  this.onUserLoggedIn.bind(this)
);
🔹 Flutter
rdnaClient.on(RdnaClient.onUserLoggedIn, onUserLoggedIn);

void onUserLoggedIn(RDNAUserLoggedIn response) {
  // Handle session start
}
🔹 Cordova
document.addEventListener('onUserLoggedIn', function(response) {
  console.log('User session:', response);
});
🔹 Native Android
@Override
public void onUserLoggedIn(RDNA.RDNAUserLoggedIn response) {
  String jwt = response.challengeResponse.additionalInfo.jwtJsonTokenInfo;
  // Proceed with session
}
🔹 Native iOS
- (void)onUserLoggedIn:(RDNAUserLoggedIn *)response {
  NSString *sessionID = response.challengeResponse.session.sessionID;
  // Navigate to app dashboard
}