# rememberAuthenticationLauncher

## Functions summary

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/biometric/compose/rememberAuthenticationLauncher.composable#rememberAuthenticationLauncher(androidx.biometric.AuthenticationResultCallback)( resultCallback: https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback )` Returns an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/biometric/compose/rememberAuthenticationLauncher.composable#rememberAuthenticationLauncher(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)( callbackExecutor: https://developer.android.com/reference/java/util/concurrent/Executor.html, resultCallback: https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback )` Returns an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication. |

## Functions

### rememberAuthenticationLauncher

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

```
@Composable
fun rememberAuthenticationLauncher(
    resultCallback: AuthenticationResultCallback
): AuthenticationResultLauncher
```

Returns an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication.

A successful or error result will be delivered to `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthResult(androidx.biometric.AuthenticationResult)` and (one or more) failures will be delivered to `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthAttemptFailed()`, which is set by `https://developer.android.com/reference/kotlin/androidx/biometric/compose/package-summary#rememberAuthenticationLauncher(androidx.biometric.AuthenticationResultCallback)`. The callback will be executed on the main thread.

```kotlin
import androidx.biometric.AuthenticationRequest
import androidx.biometric.AuthenticationRequest.Companion.biometricRequest
import androidx.biometric.compose.rememberAuthenticationLauncher
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable

var result by rememberSaveable { mutableStateOf("") }
val launcher = rememberAuthenticationLauncher { authResult -> result = authResult.toText() }
Column {
    Button(
        onClick = {
            launcher.launch(
                biometricRequest(
                    title = "test",
                    AuthenticationRequest.Biometric.Fallback.DeviceCredential,
                    AuthenticationRequest.Biometric.Fallback.CustomOption(
                        text = "Use account password",
                        iconType = AuthenticationRequest.Biometric.Fallback.ICON_TYPE_PASSWORD,
                    ),
                ) {
                    // Optionally set the other configurations. setSubtitle(), setContent(), etc
                }
            )
        }
    ) {
        Text(text = "Start Authentication")
    }
    Text(text = "Result: $result")
}
```

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/compose/rememberAuthenticationLauncher.composable#rememberAuthenticationLauncher(androidx.biometric.AuthenticationResultCallback)` | (Executor, AuthenticationResultCallback) |

### rememberAuthenticationLauncher

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

```
@Composable
fun rememberAuthenticationLauncher(
    callbackExecutor: Executor,
    resultCallback: AuthenticationResultCallback
): AuthenticationResultLauncher
```

Returns an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication.

A successful or error result will be delivered to `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthResult(androidx.biometric.AuthenticationResult)` and (one or more) failures will be delivered to `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthAttemptFailed()`, which is set by `https://developer.android.com/reference/kotlin/androidx/biometric/compose/package-summary#rememberAuthenticationLauncher(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)`. The callback will be executed on the thread provided by the `https://developer.android.com/reference/kotlin/androidx/biometric/compose/package-summary#rememberAuthenticationLauncher(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)`.

```kotlin
import androidx.biometric.AuthenticationRequest
import androidx.biometric.AuthenticationRequest.Companion.biometricRequest
import androidx.biometric.compose.rememberAuthenticationLauncher
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable

var result by rememberSaveable { mutableStateOf("") }
val launcher = rememberAuthenticationLauncher { authResult -> result = authResult.toText() }
Column {
    Button(
        onClick = {
            launcher.launch(
                biometricRequest(
                    title = "test",
                    AuthenticationRequest.Biometric.Fallback.DeviceCredential,
                    AuthenticationRequest.Biometric.Fallback.CustomOption(
                        text = "Use account password",
                        iconType = AuthenticationRequest.Biometric.Fallback.ICON_TYPE_PASSWORD,
                    ),
                ) {
                    // Optionally set the other configurations. setSubtitle(), setContent(), etc
                }
            )
        }
    ) {
        Text(text = "Start Authentication")
    }
    Text(text = "Result: $result")
}
```

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/compose/rememberAuthenticationLauncher.composable#rememberAuthenticationLauncher(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)` | (AuthenticationResultCallback) |