# GetCustomCredentialOption

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

*** ** * ** ***

<br />

```
open class GetCustomCredentialOption : 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.GetCustomCredentialOption](https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption) |

*** ** * ** ***

Allows extending custom versions of GetCredentialOptions for unique use cases.

If you get a `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption` instead of a type-safe option class such as `https://developer.android.com/reference/kotlin/androidx/credentials/GetPasswordOption`, `https://developer.android.com/reference/kotlin/androidx/credentials/GetPublicKeyCredentialOption`, etc., then you should check if you have any other library at interest that supports this custom `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(android.os.Bundle,kotlin.String,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set,kotlin.Int)` of credential option, and if so use its parsing utilities to resolve to a type-safe class within that library.

Note: The Bundle keys for `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(android.os.Bundle,kotlin.String,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set,kotlin.Int)` and `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(android.os.Bundle,kotlin.String,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set,kotlin.Int)` should not be in the form of `androidx.credentials.*` as they are reserved for internal use by this androidx library.

The `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(android.os.Bundle,kotlin.String,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set,kotlin.Int)` bit helps decide where the credential will be displayed on the selector. It is used with more importance than signals like 'last recently used' but with less importance than other signals, such as the ordering of displayed accounts. It is expected to be one of the defined `CredentialOption.PRIORITY_*` constants. By default, `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption` will have `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#PRIORITY_DEFAULT()`, `https://developer.android.com/reference/kotlin/androidx/credentials/GetPasswordOption` will have `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#PRIORITY_PASSWORD_OR_SIMILAR()` and `https://developer.android.com/reference/kotlin/androidx/credentials/GetPublicKeyCredentialOption` will have `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#PRIORITY_PASSKEY_OR_SIMILAR()`. It is expected that `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption` types will remain unchanged unless strong reasons arise and cannot ever have `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#PRIORITY_PASSKEY_OR_SIMILAR()`. Given passkeys prevent many security threats that other credentials do not, we enforce that nothing is shown higher than passkey types in order to provide end users with the safest credentials first. See the spec [here](https://w3c.github.io/webauthn/) for more information on passkeys.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#GetCustomCredentialOption(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set)( type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, requestData: https://developer.android.com/reference/android/os/Bundle.html, candidateQueryData: https://developer.android.com/reference/android/os/Bundle.html, isSystemProviderRequired: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, isAutoSelectAllowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, allowedProviders: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/android/content/ComponentName.html> )` Allows extending custom versions of GetCredentialOptions for unique use cases. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#GetCustomCredentialOption(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set,kotlin.Int)( type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, requestData: https://developer.android.com/reference/android/os/Bundle.html, candidateQueryData: https://developer.android.com/reference/android/os/Bundle.html, isSystemProviderRequired: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, isAutoSelectAllowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, allowedProviders: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/android/content/ComponentName.html>, typePriorityHint: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Allows extending custom versions of GetCredentialOptions for unique use cases. |

### Inherited properties

From [androidx.credentials.CredentialOption](https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/android/content/ComponentName.html>` `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#allowedProviders()`

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))
`https://developer.android.com/reference/android/os/Bundle.html` `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#candidateQueryData()`

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
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `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
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#isSystemProviderRequired()`

true if must only be fulfilled by a system provider and false otherwise
`https://developer.android.com/reference/android/os/Bundle.html` `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#requestData()`

the request data in the `https://developer.android.com/reference/android/os/Bundle.html` format
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `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 `https://developer.android.com/reference/kotlin/androidx/credentials/GetPasswordOption` is `https://developer.android.com/reference/kotlin/androidx/credentials/PasswordCredential#TYPE_PASSWORD_CREDENTIAL()` and for `https://developer.android.com/reference/kotlin/androidx/credentials/GetPublicKeyCredentialOption` is `https://developer.android.com/reference/kotlin/androidx/credentials/PublicKeyCredential#TYPE_PUBLIC_KEY_CREDENTIAL()`)
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `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 `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption.PriorityHints` for more information

## Public constructors

### GetCustomCredentialOption

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

```
GetCustomCredentialOption(
    type: String,
    requestData: Bundle,
    candidateQueryData: Bundle,
    isSystemProviderRequired: Boolean,
    isAutoSelectAllowed: Boolean = false,
    allowedProviders: Set<ComponentName> = emptySet()
)
```

Allows extending custom versions of GetCredentialOptions for unique use cases.

If you get a `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption` instead of a type-safe option class such as `https://developer.android.com/reference/kotlin/androidx/credentials/GetPasswordOption`, `https://developer.android.com/reference/kotlin/androidx/credentials/GetPublicKeyCredentialOption`, etc., then you should check if you have any other library at interest that supports this custom `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set)` of credential option, and if so use its parsing utilities to resolve to a type-safe class within that library.

Note: The Bundle keys for `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set)` and `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set)` should not be in the form of `androidx.credentials.*` as they are reserved for internal use by this androidx library.

| Parameters |
|---|---|
| `type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the credential type determined by the credential-type-specific subclass generated for custom use cases |
| `requestData: https://developer.android.com/reference/android/os/Bundle.html` | the request data in the `https://developer.android.com/reference/android/os/Bundle.html` format, generated for custom use cases (note: bundle keys in the form of `androidx.credentials.*` and `android.credentials.*` are reserved for internal library usage) |
| `candidateQueryData: https://developer.android.com/reference/android/os/Bundle.html` | 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 should not contain sensitive user information (note: bundle keys in the form of `androidx.credentials.*` and `android.credentials.*` are reserved for internal library usage) |
| `isSystemProviderRequired: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if must only be fulfilled by a system provider and false otherwise |
| `isAutoSelectAllowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | defines if a credential entry will be automatically chosen if it is the only one available option, false by default |
| `allowedProviders: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/android/content/ComponentName.html> = emptySet()` | 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; 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)) |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set)` is empty |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set)` or `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set)` is null |

### GetCustomCredentialOption

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

```
GetCustomCredentialOption(
    type: String,
    requestData: Bundle,
    candidateQueryData: Bundle,
    isSystemProviderRequired: Boolean,
    isAutoSelectAllowed: Boolean = false,
    allowedProviders: Set<ComponentName> = emptySet(),
    typePriorityHint: Int = PRIORITY_DEFAULT
)
```

Allows extending custom versions of GetCredentialOptions for unique use cases.

If you get a `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption` instead of a type-safe option class such as `https://developer.android.com/reference/kotlin/androidx/credentials/GetPasswordOption`, `https://developer.android.com/reference/kotlin/androidx/credentials/GetPublicKeyCredentialOption`, etc., then you should check if you have any other library at interest that supports this custom `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set,kotlin.Int)` of credential option, and if so use its parsing utilities to resolve to a type-safe class within that library.

Note: The Bundle keys for `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set,kotlin.Int)` and `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set,kotlin.Int)` should not be in the form of `androidx.credentials.*` as they are reserved for internal use by this androidx library.

The `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set,kotlin.Int)` bit helps decide where the credential will be displayed on the selector. It is expected that `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption` types will remain unchanged unless strong reasons arise and cannot ever have `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption#PRIORITY_PASSKEY_OR_SIMILAR()`. Given passkeys prevent many security threats that other credentials do not, we enforce that nothing is shown higher than passkey types in order to provide end users with the safest credentials first. See the spec [here](https://w3c.github.io/webauthn/) for more information on passkeys.

| Parameters |
|---|---|
| `type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the credential type determined by the credential-type-specific subclass generated for custom use cases |
| `requestData: https://developer.android.com/reference/android/os/Bundle.html` | the request data in the `https://developer.android.com/reference/android/os/Bundle.html` format, generated for custom use cases (note: bundle keys in the form of `androidx.credentials.*` and `android.credentials.*` are reserved for internal library usage) |
| `candidateQueryData: https://developer.android.com/reference/android/os/Bundle.html` | 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 should not contain sensitive user information (note: bundle keys in the form of `androidx.credentials.*` and `android.credentials.*` are reserved for internal library usage) |
| `isSystemProviderRequired: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if must only be fulfilled by a system provider and false otherwise |
| `isAutoSelectAllowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | defines if a credential entry will be automatically chosen if it is the only one available option, false by default |
| `allowedProviders: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/android/content/ComponentName.html> = emptySet()` | 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; 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)) |
| `typePriorityHint: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = PRIORITY_DEFAULT` | 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/kotlin/androidx/credentials/CredentialOption` and `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption` for more information |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set,kotlin.Int)` is empty |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set,kotlin.Int)` or `https://developer.android.com/reference/kotlin/androidx/credentials/GetCustomCredentialOption#(kotlin.String,android.os.Bundle,android.os.Bundle,kotlin.Boolean,kotlin.Boolean,kotlin.collections.Set,kotlin.Int)` is null |