onAddNewWebAuthnDeviceResult
client.onAddNewWebAuthnDeviceResult( requestCode, intent, success, failure )
About this command
After launching a FIDO2 registration task (with the addNewWebAuthnDevice method), this method will parse the resulting intent and if successful, the new device will be added in the user’s registered FIDO2 devices.
|
Examples
import com.reach5.identity.sdk.core.models.AuthToken
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
// Method A, using SDK helper:
val handler = reach5.resolveResultHandler(requestCode, resultCode, data)
if (handler is WebAuthnDeviceAddResult) {
handler.handle(
success = {
showToast("New FIDO2 device registered")
refreshDevicesDisplayed()
},
failure = {
Log.d(TAG, "onAddNewWebAuthnDeviceResult error=$it")
showErrorToast(it)
}
)
}
// Method B, directly calling method. Nothing happens if requestCode does not concern SDK:
reach5.onAddNewWebAuthnDeviceResult(
requestCode,
data,
success = {
showToast("New FIDO2 device registered")
refreshDevicesDisplayed()
},
failure = {
Log.d(TAG, "onAddNewWebAuthnDeviceResult error=$it")
showErrorToast(it)
}
)
}
Parameters
The Android request code obtained in |
|
The intent received after launching a FIDO2 task. |
|
Callback called once the request has succeeded. |
|
Callback called once the request has failed. You’ll get a |
Response
Type: Unit
ReachFiveError
message |
The message of the error. |
|||||||||||||||||||||||||||||||||||||||
getErrorCode() |
The error code’s enumeration value. |
|||||||||||||||||||||||||||||||||||||||
code |
The code from the underlying WebAuthn library.
|
|||||||||||||||||||||||||||||||||||||||
exception |
The stack trace of the error. |
|||||||||||||||||||||||||||||||||||||||
data |
Additional data about the error.
|