# RestoreCredential

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

*** ** * ** ***

<br />

```
class RestoreCredential : Credential
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.credentials.Credential](https://developer.android.com/reference/kotlin/androidx/credentials/Credential) ||
|   | ↳ | [androidx.credentials.RestoreCredential](https://developer.android.com/reference/kotlin/androidx/credentials/RestoreCredential) |

*** ** * ** ***

Represents the user's restore credential for the app sign in. The restore credential is used to restore the user's credential from the previous device to a new Android device.

By creating a `https://developer.android.com/reference/kotlin/androidx/credentials/RestoreCredential` for the user, the credential will be automatically transferred over to the user's new device if the user selects the app to be transferred from the old device during the setup stage.

The `https://developer.android.com/reference/kotlin/androidx/credentials/RestoreCredential` can only be used for apps that the users have selected to be restored. The `https://developer.android.com/reference/kotlin/androidx/credentials/RestoreCredential` for all other apps will not be transferred over from the old device. This Credential can be used to create a seamless authentication user experience by providing a 0-tap sign-in experience. If the `https://developer.android.com/reference/kotlin/androidx/credentials/RestoreCredential` is available for an app, the user can be signed in programmatically without the user's input.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/RestoreCredential#authenticationResponseJson()` is empty, or if it is not a valid JSON |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/CreateRestoreCredentialRequest` | on how to create a `https://developer.android.com/reference/kotlin/androidx/credentials/RestoreCredential` instance. |

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/RestoreCredential#TYPE_RESTORE_CREDENTIAL()` The type value for restore credential related operations. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/RestoreCredential#authenticationResponseJson()` the request the public key credential authentication response in JSON format that follows the standard webauthn json format shown at (https://w3c.github.io/webauthn/#dictdef-authenticationresponsejson) |

### Inherited properties

From [androidx.credentials.Credential](https://developer.android.com/reference/kotlin/androidx/credentials/Credential) `https://developer.android.com/reference/android/os/Bundle.html` `https://developer.android.com/reference/kotlin/androidx/credentials/Credential#data()`

the credential 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/Credential#type()`

the credential type determined by the credential-type-specific subclass (e.g. `https://developer.android.com/reference/kotlin/androidx/credentials/PasswordCredential#TYPE_PASSWORD_CREDENTIAL()` for `PasswordCredential` or `https://developer.android.com/reference/kotlin/androidx/credentials/PublicKeyCredential#TYPE_PUBLIC_KEY_CREDENTIAL()` for `PublicKeyCredential`)

## Constants

### TYPE_RESTORE_CREDENTIAL

```
const val TYPE_RESTORE_CREDENTIAL: String
```

The type value for restore credential related operations.

## Public properties

### authenticationResponseJson

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

```
val authenticationResponseJson: String
```

the request the public key credential authentication response in JSON format that follows the standard webauthn json format shown at (https://w3c.github.io/webauthn/#dictdef-authenticationresponsejson)