# GetDigitalCredentialOption

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/credentials/GetDigitalCredentialOption "View this page in Java")

<br />

```
@ExperimentalDigitalCredentialApi
class GetDigitalCredentialOption : CredentialOption
```

<br />

|---|---|---------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)                                                                      |||
| ↳ | [androidx.credentials.CredentialOption](https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption)                        ||
|   | ↳ | [androidx.credentials.GetDigitalCredentialOption](https://developer.android.com/reference/kotlin/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[GetCredentialRequest](https://developer.android.com/reference/kotlin/androidx/credentials/GetCredentialRequest).

## Summary

|                                                                                                                                               ### Public constructors                                                                                                                                                |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [GetDigitalCredentialOption](https://developer.android.com/reference/kotlin/androidx/credentials/GetDigitalCredentialOption#GetDigitalCredentialOption(kotlin.String))`(requestJson: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`)` Constructs a`GetDigitalCredentialOption`. |

|                               ### Public properties                               |
|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | [requestJson](https://developer.android.com/reference/kotlin/androidx/credentials/GetDigitalCredentialOption#requestJson()) the request in the JSON format; the latest format is defined at https://wicg.github.io/digital-credentials/#the-digitalcredentialrequestoptions-dictionary |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ### Inherited properties                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[androidx.credentials.CredentialOption](https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption) |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Set](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html)`<`[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)`>` | [allowedProviders](https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#allowedProviders()) a set of provider service[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)allowed to receive this option (Note: a[SecurityException](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))                      | | [Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                                                                                 | [candidateQueryData](https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#candidateQueryData()) the partial request data in the[Bundle](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                                                                                                                                                                                                                                                                                                                                                                                                                | | [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                      | [isAutoSelectAllowed](https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#isAutoSelectAllowed()) whether a credential entry will be automatically chosen if it is the only one available option                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                      | [isSystemProviderRequired](https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#isSystemProviderRequired()) true if must only be fulfilled by a system provider and false otherwise                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | [Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                                                                                 | [requestData](https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#requestData()) the request data in the[Bundle](https://developer.android.com/reference/android/os/Bundle.html)format                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                        | [type](https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#type()) the credential type determined by the credential-type-specific subclass (e.g. the type for[GetPasswordOption](https://developer.android.com/reference/kotlin/androidx/credentials/GetPasswordOption)is[PasswordCredential.TYPE_PASSWORD_CREDENTIAL](https://developer.android.com/reference/kotlin/androidx/credentials/PasswordCredential#TYPE_PASSWORD_CREDENTIAL())and for[GetPublicKeyCredentialOption](https://developer.android.com/reference/kotlin/androidx/credentials/GetPublicKeyCredentialOption)is[PublicKeyCredential.TYPE_PUBLIC_KEY_CREDENTIAL](https://developer.android.com/reference/kotlin/androidx/credentials/PublicKeyCredential#TYPE_PUBLIC_KEY_CREDENTIAL())) | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                              | [typePriorityHint](https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#typePriorityHint()) 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[PriorityHints](https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption.PriorityHints)for more information                                                                                                                                                                                                                                                                                                                                       | |

## Public constructors

### GetDigitalCredentialOption

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

```
GetDigitalCredentialOption(requestJson: String)
```

Constructs a`GetDigitalCredentialOption`.

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

|                                            Parameters                                            |
|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `requestJson: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | the request in the JSON format; the latest format is defined at https://wicg.github.io/digital-credentials/#the-digitalcredentialrequestoptions-dictionary |

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

## Public properties

### requestJson

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

```
val requestJson: String
```

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