# PasswordCredential

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

*** ** * ** ***

<br />

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

*** ** * ** ***

Represents the user's password credential granted by the user for app sign-in.

## 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/PasswordCredential#TYPE_PASSWORD_CREDENTIAL()` The type value for password related operations. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/credentials/PasswordCredential#PasswordCredential(kotlin.String,kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html password)` Constructs a `https://developer.android.com/reference/androidx/credentials/PasswordCredential`. |

| ### 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/PasswordCredential#getId()()` the user id associated with the password |
| `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/PasswordCredential#getPassword()()` the password |

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

```
public static final @NonNull String TYPE_PASSWORD_CREDENTIAL
```

The type value for password related operations.

## Public constructors

### PasswordCredential

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

```
public PasswordCredential(@NonNull String id, @NonNull String password)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id` | the user id associated with the password |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html password` | the password |

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

## Public methods

### getId

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

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

the user id associated with the password

### getPassword

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

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

the password