# 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 />

```
public final 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/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/androidx/credentials/provider/CredentialEntry` that the user selected. The request must be extracted using the `https://developer.android.com/reference/androidx/credentials/provider/PendingIntentHandler#retrieveProviderGetCredentialRequest(android.content.Intent)` helper API.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest#ProviderGetCredentialRequest(kotlin.collections.List,androidx.credentials.provider.CallingAppInfo,androidx.credentials.provider.BiometricPromptResult)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/CredentialOption> credentialOptions, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CallingAppInfo callingAppInfo, https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptResult biometricPromptResult )` Constructs an instance of `https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest` |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest#asBundle(androidx.credentials.provider.ProviderGetCredentialRequest)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest request)` Helper method to convert the given `https://developer.android.com/reference/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. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest` | `https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest#fromBundle(android.os.Bundle)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html bundle)` Helper method to convert a `https://developer.android.com/reference/android/os/Bundle.html` retrieved through `https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest#asBundle(androidx.credentials.provider.ProviderGetCredentialRequest)`, back to an instance of `https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest`. |
| `final https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptResult` | `https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest#getBiometricPromptResult()()` the result of a Biometric Prompt authentication flow, that is propagated to the provider if the provider requested for `https://developer.android.com/reference/androidx/credentials/CredentialManager` to handle the authentication flow |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CallingAppInfo` | `https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest#getCallingAppInfo()()` information pertaining to the calling application |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/CredentialOption>` | `https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest#getCredentialOptions()()` the list of credential retrieval options containing the required parameters, expected to contain a single `https://developer.android.com/reference/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/androidx/credentials/provider/PasswordCredentialEntry` or a `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry`, or expected to contain multiple `https://developer.android.com/reference/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/androidx/credentials/provider/RemoteEntry` |

| ### Extension functions |
|---|---|
| `final https://developer.android.com/reference/androidx/credentials/registry/provider/SelectedCredentialSet` | `https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest.https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest#(androidx.credentials.provider.ProviderGetCredentialRequest).getSelectedCredentialSet()( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest receiver )` Returns credential set selected by the user. |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest.https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest#(androidx.credentials.provider.ProviderGetCredentialRequest).getSelectedEntryId()( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest receiver )` Returns the id of the entry selected by the user. |

## Public constructors

### ProviderGetCredentialRequest

```
public ProviderGetCredentialRequest(
    @NonNull List<@NonNull CredentialOption> credentialOptions,
    @NonNull CallingAppInfo callingAppInfo,
    BiometricPromptResult biometricPromptResult
)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/CredentialOption> credentialOptions` | the list of credential retrieval options containing the required parameters, expected to contain a single `https://developer.android.com/reference/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/androidx/credentials/provider/PasswordCredentialEntry` or a `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry`, or expected to contain multiple `https://developer.android.com/reference/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/androidx/credentials/provider/RemoteEntry` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CallingAppInfo callingAppInfo` | information pertaining to the calling application |
| `https://developer.android.com/reference/androidx/credentials/provider/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/androidx/credentials/CredentialManager` to handle the authentication flow |

## Public methods

### asBundle

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

```
public static final @NonNull Bundle asBundle(@NonNull ProviderGetCredentialRequest request)
```

Helper method to convert the given `https://developer.android.com/reference/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/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)

```
public static final @NonNull ProviderGetCredentialRequest fromBundle(@NonNull Bundle bundle)
```

Helper method to convert a `https://developer.android.com/reference/android/os/Bundle.html` retrieved through `https://developer.android.com/reference/androidx/credentials/provider/ProviderGetCredentialRequest#asBundle(androidx.credentials.provider.ProviderGetCredentialRequest)`, back to an instance of `https://developer.android.com/reference/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/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/androidx/credentials/provider/ProviderGetCredentialRequest#asBundle(androidx.credentials.provider.ProviderGetCredentialRequest)` itself and never be created from scratch to avoid the failure.

### getBiometricPromptResult

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

```
public final BiometricPromptResult getBiometricPromptResult()
```

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

### getCallingAppInfo

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

```
public final @NonNull CallingAppInfo getCallingAppInfo()
```

information pertaining to the calling application

### getCredentialOptions

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

```
public final @NonNull List<@NonNull CredentialOption> getCredentialOptions()
```

the list of credential retrieval options containing the required parameters, expected to contain a single `https://developer.android.com/reference/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/androidx/credentials/provider/PasswordCredentialEntry` or a `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry`, or expected to contain multiple `https://developer.android.com/reference/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/androidx/credentials/provider/RemoteEntry`

## Extension functions

### ProviderGetCredentialRequest.getSelectedCredentialSet

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)

```
public final SelectedCredentialSet ProviderGetCredentialRequest.getSelectedCredentialSet(
    @NonNull ProviderGetCredentialRequest receiver
)
```

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/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/androidx/credentials/provider/ProviderGetCredentialRequest` containing the selection information, see `https://developer.android.com/reference/androidx/credentials/registry/provider/RegistryManager#ACTION_GET_CREDENTIAL()`.

### ProviderGetCredentialRequest.getSelectedEntryId

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)

```
public final String ProviderGetCredentialRequest.getSelectedEntryId(
    @NonNull ProviderGetCredentialRequest receiver
)
```

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/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/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/androidx/credentials/provider/ProviderGetCredentialRequest` containing the selection information, see `https://developer.android.com/reference/androidx/credentials/registry/provider/RegistryManager#ACTION_GET_CREDENTIAL()`.