# GetRestoreCredentialOption

# GetRestoreCredentialOption

Artifact:[androidx.credentials:credentials](https://developer.android.com/jetpack/androidx/releases/credentials)  
[View Source](https://cs.android.com/search?q=file:androidx/credentials/GetRestoreCredentialOption.kt+class:androidx.credentials.GetRestoreCredentialOption)  
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/GetRestoreCredentialOption "View this page in Java")

<br />

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

*** ** * ** ***

A request to get the restore credential from the restore credential provider.  

|                                                                            Throws                                                                             |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.IllegalArgumentException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html)                                | if the requestJson is an invalid Json that does not follow the standard webauthn web json format                                            |
| [androidx.credentials.exceptions.NoCredentialException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/NoCredentialException) | if no viable restore credential is found                                                                                                    |
| [kotlin.IllegalArgumentException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html)                                | if the option is mixed with another[CredentialOption](https://developer.android.com/reference/kotlin/androidx/credentials/CredentialOption) |

## Summary

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

|                               ### Public properties                               |
|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | [requestJson](https://developer.android.com/reference/kotlin/androidx/credentials/GetRestoreCredentialOption#requestJson()) the request in JSON format in the standard webauthn web json (https://w3c.github.io/webauthn/#dictdef-publickeycredentialrequestoptionsjson). |

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

### GetRestoreCredentialOption

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

```
GetRestoreCredentialOption(requestJson: String)
```  

## 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 JSON format in the standard webauthn web json (https://w3c.github.io/webauthn/#dictdef-publickeycredentialrequestoptionsjson).

Note that the userVerification field of the requestJson will always be overridden to`discouraged`to support passive authentication during restore flow.

[GetRestoreCredentialOption](https://developer.android.com/reference/kotlin/androidx/credentials/GetRestoreCredentialOption)cannot be requested with other credential options because of conflicting user experience. When requesting restore credential, only a single[GetRestoreCredentialOption](https://developer.android.com/reference/kotlin/androidx/credentials/GetRestoreCredentialOption)must be supplied.