# GetPasswordOption

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

*** ** * ** ***

<br />

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

*** ** * ** ***

A request to retrieve the user's saved application password from their password provider.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/GetPasswordOption#GetPasswordOption(kotlin.collections.Set,kotlin.Boolean,kotlin.collections.Set)( allowedUserIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/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> )` Constructs a `https://developer.android.com/reference/kotlin/androidx/credentials/GetPasswordOption`. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html>` | `https://developer.android.com/reference/kotlin/androidx/credentials/GetPasswordOption#allowedUserIds()` a optional set of user ids with which the credentials associated are requested; leave as empty if you want to request all the available user credentials |

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

### GetPasswordOption

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

```
GetPasswordOption(
    allowedUserIds: Set<String> = emptySet(),
    isAutoSelectAllowed: Boolean = false,
    allowedProviders: Set<ComponentName> = emptySet()
)
```

Constructs a `https://developer.android.com/reference/kotlin/androidx/credentials/GetPasswordOption`.

| Parameters |
|---|---|
| `allowedUserIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html> = emptySet()` | a optional set of user ids with which the credentials associated are requested; leave as empty if you want to request all the available user credentials |
| `isAutoSelectAllowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | false by default, allows auto selecting a password if there is only one available |
| `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)) |

## Public properties

### allowedUserIds

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

```
val allowedUserIds: Set<String>
```

a optional set of user ids with which the credentials associated are requested; leave as empty if you want to request all the available user credentials