New Device Activation
Recover from Client State
Pass the client state created during enrollment flow or via IDV Bridge to recover the account on a new device. Use the client state you obtained and stored securely when enrolling users via IDV Bridge or Mobile SDK.
| When enrolling from client state, PingOne Recognize shows the enrollment UI to users (from SDK 5.0.1 onward), including live filters. |
Android
// clientState retrieved from previous step
val clientState = "<your_client_state>"
val enrollConfig = BiomEnrollConfig(clientState = clientState)
Keyless.enroll(
configuration = enrollConfig,
onCompletion = { result ->
when (result) {
is Keyless.KeylessResult.Success -> {
// account recovered
val userId = result.value.userId
}
is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "error code ${result.error.code}")
}
}
)
iOS
// clientState retrieved from previous step
let clientState = "<your_client_state>"
let enrollConfig = BiomEnrollConfig(clientState: clientState)
Keyless.enroll(
configuration: enrollConfig,
onCompletion: { result in
switch result {
case .success(let enrollSuccess):
// account recovered
let userId = enrollSuccess.userId
case .failure(let error):
print("error code: \(error.code)")
}
}
)
Flutter
import 'package:keyless_flutter_sdk/keyless.dart';
import 'package:keyless_flutter_sdk/models/configurations/enrollment_configuration.dart';
// temporaryState retrieved from previous step
final temporaryState = "<your_temporary_state>";
final enrollConfig = BiomEnrollConfig(temporaryState: temporaryState);
try {
final result = await Keyless.instance.enroll(enrollConfig);
// account recovered
print("Account recovered successfully. UserID: ${result.keylessId}");
} catch (error) {
print("Account recovery failed: $error");
}
React Native
const clientState = '<your_client_state>';
const config = new BiomEnrollConfig({
clientState: clientState,
});
const result = await Keyless.enroll(config);
result.fold({
onSuccess(data) {
logConsole('Enroll result success ' + JSON.stringify(data, null, 2));
},
onFailure(error) {
logConsole('Enroll result failure ' + JSON.stringify(error, null, 2));
},
});
After account recovery, it is possible to continue authenticating the user with ongoing two-factor authentication.