updatePassword

🔧 updatePassword API

The updatePassword API enables users to securely update their current password. It supports both user-initiated (manual) and policy-driven (expiry) password changes. SDK will first validate the credential with which the user islogged-in and then proceed for password update.


🎯 Purpose

  • 🔐 Securely update an existing password
  • 🔄 Support both proactive and expiry-triggered updates
  • 🛡 Maintain compliance with security and rotation policies

📥 Parameters

Name

Type

Description

currentPassword

String

User's current password

newPassword

String

New password chosen by user

challengeMode

int

RDNA_OP_UPDATE_CREDENTIALS(2) = manual, RDNA_OP_UPDATE_ON_EXPIRY(4)= expiry-triggered update. Pass the same mode obtained in getPassword event.


💡 Sample Code by Framework

React Native
RdnaClient.updatePassword("currentPass123", "newPass456", 2, (response) => {
  if (response.statusCode === 100) {
    console.log("Password updated successfully");
  } else {
    console.error("Update failed:", response.statusMessage);
  }
});
Flutter
try {
  final response = await rdnaClient.updatePassword("currentPass123", "newPass456", 2);
  print("Password updated successfully");
} catch (e) {
  print("Update failed: $e");
}
Cordova
com.uniken.rdnaplugin.RdnaClient.updatePassword(
  () => console.log("Password updated successfully"),
  (err) => console.error("Update failed", err),
  ["currentPass123", "newPass456", 2]
);
Native Android (Java)
RDNAError error = rdna.updatePassword("currentPass123", "newPass456", 2);
if (error.getShortErrorCode() == 100) {
    Log.d("Update", "Password updated successfully");
} else {
    Log.e("Update", "Failed: " + error.getErrorString());
}
Native iOS (Objective-C)
RDNAError *error = [rdna updatePassword:@"currentPass123"
                             newPassword:@"newPass456"
                          challengeMode:2];
if (error.shortErrorCode == 100) {
    NSLog(@"Password updated successfully");
} else {
    NSLog(@"Update failed: %@", error.errorString);
}