Skip to main content

Change Password

A user can modify their password after logging into the application.

KSSIDP Change Password Flow Diagram for KOBIL Shift Lite

The event flow diagram illustrates the sequence of events during the change password process for KOBIL Shift Lite - KSSIDP.

Implementation Examples

Swift/iOS

The KssIdpChangePassword function acts as the bridge between the user interface and the identity provider. This function utilizes the changePin method from kssIdpWrapper to trigger the change password process, with the result being handled by the handleResult function.

Triggering KssIdpChangePassword (Swift/iOS)
func KssIdpChangePassword(
clientId: String,
credentials: [String: String]) {

self.kssIdpWrapper.changePin(
clientId: clientId,
credentials: credentials
) { resultObject, _ in
handleResult(resultObject: resultObject)
}
}

Android/Kotlin

This function utilizes the changePin method from KssIdp Instance to trigger the change password process, with the result being handled by the onResultReceived listener.

Triggering KssIdpChangePassword (Android/Kotlin)
fun triggerKssIdpChangePassword(
clientId: String,
credentials: HashMap<String, String>,
onResultReceived: ((result: ResultObject) -> Unit)? = onResultReceivedCallback
) {
launchIO {
KssIdp.getInstance()?.changePin(clientId, credentials, onResultReceived)?.then {
// handle result
}
}
}

Flutter/Dart

The Flutter implementation uses the KssIdpApi to trigger the change password process. This function handles user credentials including the current password and new password, processing the result through the IDP flow.

Triggering KssIdpChangePassword (Flutter/Dart)
Future<void> performKssChangePassword(
String username,
String currentPassword,
String newPassword) async {
try {
// Create credentials map with current and new passwords
final credentials = {
'username': username,
'current-password': currentPassword,
'new-password': newPassword,
};

// Get your KssIdpApi instance
final kssIdpHelper = locator<KssIdpHelper>();

// Perform the change password request
final changePasswordResult = await kssIdpHelper.idpApi.changePassword(
'your-client-id', // Replace with actual client ID
credentials,
);

// Handle the change password result
switch (changePasswordResult.status.runtimeType) {
case KssIdpStatusSuccess:
print("✅ Password changed successfully");
break;

case KssIdpStatusRequestFailed:
final error = (changePasswordResult.status as KssIdpStatusRequestFailed).errorDescription;
print("❌ Password change request failed: $error");
break;

case KssIdpStatusEventFailed:
final error = (changePasswordResult.status as KssIdpStatusEventFailed).errorDescription;
print("❌ Password change event failed: $error");
break;

default:
print("❓ Unknown password change result status");
}

} catch (e) {
print("❌ Password change exception: $e");
// Handle exception
}
}

For an example that uses Flutter Redux for state management, you can view our provided demo app.

Request Parameters

The following parameters are used in KSSIDP Change Password:

clientId: This value is provided by the KOBIL IDP services.
credentials: {
"username": VALUE-TO-PASS,
"current-password": VALUE-TO-PASS,
"new-password": VALUE-TO-PASS
}

Important Notes

For more information about MC usage during KSSIDP flows, please refer to the CreateHttpCommonRequest and SetAuthorisationCode events.

Response Handling

In response to a ChangePin Event, KSSIDP sends a KssIdpResultObject with the appropriate status.