# GetDigitalCredentialOption

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

*** ** * ** ***


```
@ExperimentalDigitalCredentialApi
public final class GetDigitalCredentialOption extends CredentialOption
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.credentials.CredentialOption](https://developer.android.com/reference/androidx/credentials/CredentialOption) ||
|   | ↳ | [androidx.credentials.GetDigitalCredentialOption](https://developer.android.com/reference/androidx/credentials/GetDigitalCredentialOption) |

*** ** * ** ***

A request to retrieve the user's digital credential, normally used for verification or sign-in purpose.

Note that this option cannot be combined with other types of options in a single `https://developer.android.com/reference/androidx/credentials/GetCredentialRequest`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/credentials/GetDigitalCredentialOption#GetDigitalCredentialOption(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html requestJson)` Constructs a `GetDigitalCredentialOption`. |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/credentials/GetDigitalCredentialOption#getRequestJson()()` the request in the JSON format; the latest format is defined at https://wicg.github.io/digital-credentials/#the-digitalcredentialrequestoptions-dictionary |

| ### Inherited methods |
|---|
| From [androidx.credentials.CredentialOption](https://developer.android.com/reference/androidx/credentials/CredentialOption) |---|---| | `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/ComponentName.html>` | `https://developer.android.com/reference/androidx/credentials/CredentialOption#getAllowedProviders()()` a set of provider service `https://developer.android.com/reference/android/content/ComponentName.html` allowed to receive this option (Note: a `https://developer.android.com/reference/java/lang/SecurityException.html` will be thrown if it is set as non-empty but your app does not have android.permission.CREDENTIAL_MANAGER_SET_ALLOWED_PROVIDERS; empty means every provider is eligible; for API level \< 34, this property will not take effect and you should control the allowed provider via [library dependencies](https://developer.android.com/training/sign-in/passkeys#add-dependencies)) | | `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/CredentialOption#getCandidateQueryData()()` the partial request data in the `https://developer.android.com/reference/android/os/Bundle.html` format that will be sent to the provider during the initial candidate query stage, which will not contain sensitive user information | | `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/CredentialOption#getRequestData()()` the request data in the `https://developer.android.com/reference/android/os/Bundle.html` format | | `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/credentials/CredentialOption#getType()()` the credential type determined by the credential-type-specific subclass (e.g. the type for `https://developer.android.com/reference/androidx/credentials/GetPasswordOption` is `https://developer.android.com/reference/androidx/credentials/PasswordCredential#TYPE_PASSWORD_CREDENTIAL()` and for `https://developer.android.com/reference/androidx/credentials/GetPublicKeyCredentialOption` is `https://developer.android.com/reference/androidx/credentials/PublicKeyCredential#TYPE_PUBLIC_KEY_CREDENTIAL()`) | | `final int` | `https://developer.android.com/reference/androidx/credentials/CredentialOption#getTypePriorityHint()()` sets the priority of this entry, which defines how it appears in the credential selector, with less precedence than account ordering but more precedence than last used time; see `https://developer.android.com/reference/androidx/credentials/CredentialOption.PriorityHints` for more information | | `final boolean` | `https://developer.android.com/reference/androidx/credentials/CredentialOption#isAutoSelectAllowed()()` whether a credential entry will be automatically chosen if it is the only one available option | | `final boolean` | `https://developer.android.com/reference/androidx/credentials/CredentialOption#isSystemProviderRequired()()` true if must only be fulfilled by a system provider and false otherwise | |

## Public constructors

### GetDigitalCredentialOption

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

```
public GetDigitalCredentialOption(@NonNull String requestJson)
```

Constructs a `GetDigitalCredentialOption`.

Note that this option cannot be combined with other types of options in a single `https://developer.android.com/reference/androidx/credentials/GetCredentialRequest`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html requestJson` | the request in the JSON format; the latest format is defined at https://wicg.github.io/digital-credentials/#the-digitalcredentialrequestoptions-dictionary |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the `credentialJson` is not a valid json |

## Public methods

### getRequestJson

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

```
public final @NonNull String getRequestJson()
```

the request in the JSON format; the latest format is defined at https://wicg.github.io/digital-credentials/#the-digitalcredentialrequestoptions-dictionary