Alternate Login Id

📌 Overview

This document covers the user-friendly login ID setup flow using the following REL-ID SDK components:

  • getLoginId – SDK event requesting an alternate login ID from the user.
  • addAlternateLoginId – API to submit a user-defined login ID.
  • onLoginIdUpdateStatus – Event confirming if the login ID was successfully registered.

These components work together as part of device activation or initial login flow to personalize user access credentials.***

🔁 Flow of Execution


[SDK triggers getLoginId]

↓
[App prompts user to enter alternate login ID]
↓
[App calls addAlternateLoginId(loginId)]
↓
[SDK validates and triggers onLoginIdUpdateStatus]
↓
→ Success: Proceed with login or show success message
→ Failure: Show error and ask for new login ID

📤 getLoginId – Event

🔍 Purpose

Triggered by the SDK to ask the user for a custom, easy-to-remember login ID.

🖥️ UI Requirement

Prompt user with a screen/form to enter their alternate login ID.

📦 Payload

None – this is a simple trigger event.

🧠 Platform Snippets

🟡 React Native
rdnaEventRegistery.addListener('getLoginId', () => {
  // Prompt user for login ID, then call addAlternateLoginId()
});
🔵 Flutter
rdnaClient.on(RdnaClient.getLoginId, (String? eventData) {
  rdnaClient.addAlternateLoginId("aditya123");
});
🟤 Cordova
document.addEventListener('getLoginId', function() {
  com.uniken.rdnaplugin.RdnaClient.addAlternateLoginId(
    function(success) {
      console.log("Login ID set", success);
    },
    function(error) {
      console.error("Failed to set login ID", error);
    },
    ["aditya123"]
  );
});
⚪ Native iOS
func getLoginId() {
    RdnaClient.addAlternateLoginId("aditya123")
}
🟢 Native Android
@Override
public void getLoginId() {
    rdna.addAlternateLoginId("aditya123");
}


🛠️ addAlternateLoginId – API

🔍 Purpose

Sends the user-provided login ID to REL-ID SDK for registration.

🧾 Parameters

FieldTypeDescription
loginIdStringAlternate ID entered by the user

🧠 Platform Snippets

🟡 React Native
RdnaClient.addAlternateLoginId("aditya123", (syncResponse) => {
  console.log("Login ID submitted", syncResponse);
});
🔵 Flutter
rdnaClient.addAlternateLoginId("aditya123");
🟤 Cordova
com.uniken.rdnaplugin.RdnaClient.addAlternateLoginId(
  function(success) {
    console.log("Login ID set", success);
  },
  function(error) {
    console.error("Failed to set login ID", error);
  },
  ["aditya123"]
);
⚪ Native iOS
RdnaClient.addAlternateLoginId("aditya123")
🟢 Native Android
rdna.addAlternateLoginId("aditya123");

📨 onLoginIdUpdateStatus – Event

🔍 Purpose

Confirms whether addAlternateLoginId succeeded or failed.

📦 Payload Fields

FieldDescription
newLoginIdLogin ID attempted to be registered
statusContains statusCode & statusMessage
errorObject with errorString if failure occurs

✅ Typical Use

  • Show success toast or proceed to next step on success.
  • Show error message and prompt re-entry on failure.

🧠 Platform Snippets

React Native
rdnaEventRegistery.addListener('onLoginIdUpdateStatus', (event) => {
  if (event?.status?.statusCode === 0) {
    console.log("Login ID saved successfully");
  } else {
    alert(event?.error?.errorString);
  }
});
Flutter
rdnaClient.on(RdnaClient.onLoginIdUpdateStatus, (event) {
  if (event?.status?.statusCode == 0) {
    print("Login ID saved successfully");
  } else {
    print("Error: ${event?.error?.errorString}");
  }
});
Cordova
document.addEventListener('onLoginIdUpdateStatus', function(event) {
  if (event?.status?.statusCode === 0) {
    console.log("Login ID saved successfully");
  } else {
    console.error("Error: " + event?.error?.errorString);
  }
});
Native iOS
func onLoginIdUpdateStatus(_ newLoginId: String, status: RequestStatus, error: Error) {
    if status.statusCode == 0 {
        print("Login ID saved successfully")
    } else {
        print("Error: \(error.errorString ?? "Unknown error")")
    }
}
Native Android
@Override
public void onLoginIdUpdateStatus(String newLoginId, RequestStatus status, Error error) {
    if (status.getStatusCode() == 0) {
        Log.d("REL-ID", "Login ID saved successfully");
    } else {
        Log.e("REL-ID", "Error: " + error.getErrorString());
    }
}

🧷 Summary

  • getLoginId → SDK asks app for login ID.
  • addAlternateLoginId → App submits ID.
  • onLoginIdUpdateStatus → SDK confirms result.Ensure this flow is implemented for successful personalization and login ID association.