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

```
public final class RestoreCredential extends Credential
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.credentials.Credential](https://developer.android.com/reference/androidx/credentials/Credential) ||
|   | ↳ | [androidx.credentials.RestoreCredential](https://developer.android.com/reference/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/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/androidx/credentials/RestoreCredential` can only be used for apps that the users have selected to be restored. The `https://developer.android.com/reference/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/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/androidx/credentials/RestoreCredential#authenticationResponseJson()` is empty, or if it is not a valid JSON |

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

## Summary

| ### Constants |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/credentials/RestoreCredential#TYPE_RESTORE_CREDENTIAL()` The type value for restore credential related operations. |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/credentials/RestoreCredential#getAuthenticationResponseJson()()` 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 methods

From [androidx.credentials.Credential](https://developer.android.com/reference/androidx/credentials/Credential) `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html` `https://developer.android.com/reference/androidx/credentials/Credential#getData()()`

the credential data in the `https://developer.android.com/reference/android/os/Bundle.html` format
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/credentials/Credential#getType()()`

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

## Constants

### TYPE_RESTORE_CREDENTIAL

```
public static final @NonNull String TYPE_RESTORE_CREDENTIAL
```

The type value for restore credential related operations.

## Public methods

### getAuthenticationResponseJson

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

```
public final @NonNull String getAuthenticationResponseJson()
```

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)