# ProviderGetCredentialRequest

Artifact: [androidx.credentials:credentials](https://developer.android.com/jetpack/androidx/releases/credentials) [View Source](https://cs.android.com/search?q=file:androidx/credentials/provider/ProviderGetCredentialRequest.kt+class:androidx.credentials.provider.ProviderGetCredentialRequest) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

*** ** * ** ***

<br />

```
class ProviderGetCredentialRequest
```

<br />

*** ** * ** ***

Request received by the provider after the query phase of the get flow is complete i.e. the user was presented with a list of credentials, and the user has now made a selection from the list of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CredentialEntry` presented on the selector UI.

This request will be added to the intent extras of the activity invoked by the `https://developer.android.com/reference/android/app/PendingIntent.html` set on the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CredentialEntry` that the user selected. The request must be extracted using the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/PendingIntentHandler#retrieveProviderGetCredentialRequest(android.content.Intent)` helper API.

## Summary

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest#asBundle(androidx.credentials.provider.ProviderGetCredentialRequest)(request: https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest)` Helper method to convert the given `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest.Companion#asBundle(androidx.credentials.provider.ProviderGetCredentialRequest)` to a parcelable `https://developer.android.com/reference/android/os/Bundle.html`, in case the instance needs to be sent across a process. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest#fromBundle(android.os.Bundle)(bundle: https://developer.android.com/reference/android/os/Bundle.html)` Helper method to convert a `https://developer.android.com/reference/android/os/Bundle.html` retrieved through `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest#asBundle(androidx.credentials.provider.ProviderGetCredentialRequest)`, back to an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest`. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest#ProviderGetCredentialRequest(kotlin.collections.List,androidx.credentials.provider.CallingAppInfo,androidx.credentials.provider.BiometricPromptResult)( credentialOptions: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption>, callingAppInfo: https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo, biometricPromptResult: https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptResult? )` Constructs an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest` |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptResult?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest#biometricPromptResult()` the result of a Biometric Prompt authentication flow, that is propagated to the provider if the provider requested for `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager` to handle the authentication flow |
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest#callingAppInfo()` information pertaining to the calling application |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption>` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest#credentialOptions()` the list of credential retrieval options containing the required parameters, expected to contain a single `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption` when this request is retrieved from the `https://developer.android.com/reference/android/app/Activity.html` invoked by the `https://developer.android.com/reference/android/app/PendingIntent.html` set on a `https://developer.android.com/reference/kotlin/androidx/credentials/provider/PasswordCredentialEntry` or a `https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry`, or expected to contain multiple `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption` when this request is retrieved from the `https://developer.android.com/reference/android/app/Activity.html` invoked by the `https://developer.android.com/reference/android/app/PendingIntent.html` set on a `https://developer.android.com/reference/kotlin/androidx/credentials/provider/RemoteEntry` |

| ### Extension properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/registry/provider/SelectedCredentialSet?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest.https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest#(androidx.credentials.provider.ProviderGetCredentialRequest).selectedCredentialSet()` Returns credential set selected by the user. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest.https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest#(androidx.credentials.provider.ProviderGetCredentialRequest).selectedEntryId()` Returns the id of the entry selected by the user. |

## Public companion functions

### asBundle

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.5.0)

```
fun asBundle(request: ProviderGetCredentialRequest): Bundle
```

Helper method to convert the given `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest.Companion#asBundle(androidx.credentials.provider.ProviderGetCredentialRequest)` to a parcelable `https://developer.android.com/reference/android/os/Bundle.html`, in case the instance needs to be sent across a process. Consumers of this method should use `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest#fromBundle(android.os.Bundle)` to reconstruct the class instance back from the bundle returned here.

### fromBundle

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.5.0)

```
fun fromBundle(bundle: Bundle): ProviderGetCredentialRequest
```

Helper method to convert a `https://developer.android.com/reference/android/os/Bundle.html` retrieved through `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest#asBundle(androidx.credentials.provider.ProviderGetCredentialRequest)`, back to an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest`.

Throws `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` if the conversion fails. This means that the given `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest.Companion#fromBundle(android.os.Bundle)` does not contain a `ProviderGetCredentialRequest`. The bundle should be constructed and retrieved from `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest#asBundle(androidx.credentials.provider.ProviderGetCredentialRequest)` itself and never be created from scratch to avoid the failure.

## Public constructors

### ProviderGetCredentialRequest

```
ProviderGetCredentialRequest(
    credentialOptions: List<CredentialOption>,
    callingAppInfo: CallingAppInfo,
    biometricPromptResult: BiometricPromptResult? = null
)
```

Constructs an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest`

| Parameters |
|---|---|
| `credentialOptions: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption>` | the list of credential retrieval options containing the required parameters, expected to contain a single `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption` when this request is retrieved from the `https://developer.android.com/reference/android/app/Activity.html` invoked by the `https://developer.android.com/reference/android/app/PendingIntent.html` set on a `https://developer.android.com/reference/kotlin/androidx/credentials/provider/PasswordCredentialEntry` or a `https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry`, or expected to contain multiple `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption` when this request is retrieved from the `https://developer.android.com/reference/android/app/Activity.html` invoked by the `https://developer.android.com/reference/android/app/PendingIntent.html` set on a `https://developer.android.com/reference/kotlin/androidx/credentials/provider/RemoteEntry` |
| `callingAppInfo: https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo` | information pertaining to the calling application |
| `biometricPromptResult: https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptResult? = null` | the result of a Biometric Prompt authentication flow, that is propagated to the provider if the provider requested for `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager` to handle the authentication flow |

## Public properties

### biometricPromptResult

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.5.0)

```
val biometricPromptResult: BiometricPromptResult?
```

the result of a Biometric Prompt authentication flow, that is propagated to the provider if the provider requested for `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager` to handle the authentication flow

### callingAppInfo

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

```
val callingAppInfo: CallingAppInfo
```

information pertaining to the calling application

### credentialOptions

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

```
val credentialOptions: List<CredentialOption>
```

the list of credential retrieval options containing the required parameters, expected to contain a single `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption` when this request is retrieved from the `https://developer.android.com/reference/android/app/Activity.html` invoked by the `https://developer.android.com/reference/android/app/PendingIntent.html` set on a `https://developer.android.com/reference/kotlin/androidx/credentials/provider/PasswordCredentialEntry` or a `https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry`, or expected to contain multiple `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption` when this request is retrieved from the `https://developer.android.com/reference/android/app/Activity.html` invoked by the `https://developer.android.com/reference/android/app/PendingIntent.html` set on a `https://developer.android.com/reference/kotlin/androidx/credentials/provider/RemoteEntry`

## Extension properties

### ProviderGetCredentialRequest.selectedCredentialSet

Artifact: [androidx.credentials.registry:registry-provider](https://developer.android.com/jetpack/androidx/releases/credentials-registry) [View Source](https://cs.android.com/search?q=file:androidx/credentials/registry/provider/ProviderGetCredentialRequest.kt+symbol:selectedCredentialSet) Added in [1.0.0-alpha05](https://developer.android.com/jetpack/androidx/releases/credentials-registry#1.0.0-alpha05)

```
val ProviderGetCredentialRequest.selectedCredentialSet: SelectedCredentialSet?
```

Returns credential set selected by the user.

A null return means that the credential user case isn't registry based. In other words, it means the credentials weren't registered through the `https://developer.android.com/reference/kotlin/androidx/credentials/registry/provider/RegistryManager#registerCredentials(androidx.credentials.registry.provider.RegisterCredentialsRequest)` API.

For how to handle a user selection and extract the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest` containing the selection information, see `https://developer.android.com/reference/kotlin/androidx/credentials/registry/provider/RegistryManager#ACTION_GET_CREDENTIAL()`.

### ProviderGetCredentialRequest.selectedEntryId

Artifact: [androidx.credentials.registry:registry-provider](https://developer.android.com/jetpack/androidx/releases/credentials-registry) [View Source](https://cs.android.com/search?q=file:androidx/credentials/registry/provider/ProviderGetCredentialRequest.kt+symbol:selectedEntryId) Added in [1.0.0-alpha05](https://developer.android.com/jetpack/androidx/releases/credentials-registry#1.0.0-alpha05)

```
val ProviderGetCredentialRequest.selectedEntryId: String?
```

Returns the id of the entry selected by the user. For example, for a digital credential entry, this maps to the corresponding entry's `https://developer.android.com/reference/kotlin/androidx/credentials/registry/provider/digitalcredentials/DigitalCredentialEntry#id()`.

A null return means that entry ID isn't supported for the given type of the use case at all. For example, a `https://developer.android.com/reference/kotlin/androidx/credentials/provider/PasswordCredentialEntry` does not have an id property and so this getter will return null if the selected entry was a password credential.

For how to handle a user selection and extract the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/ProviderGetCredentialRequest` containing the selection information, see `https://developer.android.com/reference/kotlin/androidx/credentials/registry/provider/RegistryManager#ACTION_GET_CREDENTIAL()`.