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
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
addAlternateLoginId ā APIš Purpose
Sends the user-provided login ID to REL-ID SDK for registration.
š§¾ Parameters
| Field | Type | Description |
|---|---|---|
| loginId | String | Alternate 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
onLoginIdUpdateStatus ā Eventš Purpose
Confirms whether addAlternateLoginId succeeded or failed.
š¦ Payload Fields
| Field | Description |
|---|---|
newLoginId | Login ID attempted to be registered |
status | Contains statusCode & statusMessage |
error | Object 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.
Updated 9 months ago
