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
}