# AuthenticationResultCallback

Artifact: [androidx.biometric:biometric](https://developer.android.com/jetpack/androidx/releases/biometric) [View Source](https://cs.android.com/search?q=file:androidx/biometric/AuthenticationResultCallback.kt+class:androidx.biometric.AuthenticationResultCallback) Added in [1.4.0-beta01](https://developer.android.com/jetpack/androidx/releases/biometric#1.4.0-beta01)

*** ** * ** ***


```
fun interface AuthenticationResultCallback
```

<br />

*** ** * ** ***

A callback to be called when an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResult` is available.

## Summary

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthAttemptFailed()()` The callback to be called if an authentication attempt has failed due to a wrong biometric recognition (e.g. wrong fingerprint, wrong face). |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthResult(androidx.biometric.AuthenticationResult)(result: https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResult)` Called when the authentication process is completed successfully or with an error. |

## Public functions

### onAuthAttemptFailed

Added in [1.4.0-beta01](https://developer.android.com/jetpack/androidx/releases/biometric#1.4.0-beta01)

```
open fun onAuthAttemptFailed(): Unit
```

The callback to be called if an authentication attempt has failed due to a wrong biometric recognition (e.g. wrong fingerprint, wrong face). This callback will be called for every failed attempt, if any.

For example:

```kotlin
override fun onAuthAttemptFailed() {
     // Track how many times a user fails (e.g., for internal analytics).

     // Note: Do NOT show a Toast or Dialog here usually, because the system UI
     // already shows "Not recognized" text on Biometric Prompt.
}
```

### onAuthResult

Added in [1.4.0-beta01](https://developer.android.com/jetpack/androidx/releases/biometric#1.4.0-beta01)

```
fun onAuthResult(result: AuthenticationResult): Unit
```

Called when the authentication process is completed successfully or with an error.

The authentication result will contain the details about the result.

This callback will always be called once and only once per authentication session.

For example:

```kotlin
override fun onAuthResult(result: AuthenticationResult) {
     when (result) {
             is AuthenticationResult.Success -> {
                 // Handle success
             }
             is AuthenticationResult.Error -> {
                // Handle authentication error, e.g. negative button click, user
                // cancellation, etc
             }
     }
}
```