Forgot Password
Once the account has been activated, users can utilize the Forgot Password feature to create a new password by entering their user ID, activation code, and new password. The activation code can be obtained using the Postman Collection API. Refer to How to get activation code.
KSSIDP Forgot Password Flow Diagram for KOBIL Shift Lite
The event flow diagram illustrates the sequence of events during the forgot password process for KOBIL Shift Lite - KSSIDP.
Implementation Examples
Swift/iOS
The KssIdpForgotPassword function acts as the bridge between the user interface and the identity provider. This function utilizes the forgotPin method from kssIdpWrapper to trigger the forgot pin process, with the result being handled by the handleResult function.
private func doForgotPin(userType: ShiftUserTypes, credentials: [String: String], parentSpan: String?) {
guard let credentials = idpData?.getDict() else {
return
}
self.kssIdpWrapper.forgotPin(clientId: userType.clientId,
credentials: credentials,
parentSpan: parentSpan) { _, newResultObject in
self.handleNewResult(newResultObject: newResultObject)
}
}
Android/Kotlin
KssIdp Instance provides a function to trigger the IDP forgot password process. You can handle the result in a lambda or in your KssIdp.OnResultReceivedListener implementation.
// handle result in lambda
KssIdp.getInstance()?.forgotPin(
clientId = idpClientId,
credentials = credentialsHashMap
) { kssIdpResultObject ->
handleResult(kssIdpResultObject)
}
// handle result in KssIdp.OnResultReceivedListener implementation
class KssIdpModel : KssIdp.OnResultReceivedListener {
fun kssIdpForgotPin(
clientId: String,
credentials: HashMap<String, String>
) {
KssIdp.getInstance()?.forgotPin(
clientId = idpClientId,
credentials = credentialsHashMap
)
}
override fun onResultReceived(result: KssIdpResultObject) {
handleResult(kssIdpResultObject)
}
}
// you can also pass a KssIdp.OnResultReceivedListener implementation to the KSSIDP function
KssIdp.getInstance()?.forgotPin(
clientId = idpClientId,
credentials = credentialsHashMap,
onResultReceived = onResultReceivedListenerImpl
)
Flutter/Dart
The Flutter implementation uses the KssIdpApi to trigger the forgot password process. This function handles user credentials including the activation code and new password, processing the result through the IDP flow.
Future<void> performKssForgotPassword(
String username,
String activationCode,
String newPassword) async {
try {
// Create credentials map with activation code and new password
final credentials = {
'username': username,
'activation-code': activationCode,
'new-password': newPassword,
};
// Get your KssIdpApi instance
final kssIdpHelper = locator<KssIdpHelper>();
// Perform the forgot password request
final forgotPasswordResult = await kssIdpHelper.idpApi.forgotPassword(
'your-client-id',
credentials,
);
// Handle the forgot password result
switch (forgotPasswordResult.status.runtimeType) {
case KssIdpStatusSuccess:
print("✅ Password reset successful");
break;
case KssIdpStatusRequestFailed:
final error = (forgotPasswordResult.status as KssIdpStatusRequestFailed).errorDescription;
print("❌ Password reset request failed: $error");
break;
case KssIdpStatusEventFailed:
final error = (forgotPasswordResult.status as KssIdpStatusEventFailed).errorDescription;
print("❌ Password reset event failed: $error");
break;
default:
print("❓ Unknown password reset result status");
}
} catch (e) {
print("❌ Password reset 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 Forgot Password:
clientId: This value is provided by the KOBIL IDP services.
credentials: {
"username": VALUE-TO-PASS,
"activation-code": 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 ForgotPin Event, KSSIDP sends a KssIdpResultObject with the appropriate status.