# CustomCredential

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

*** ** * ** ***


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

*** ** * ** ***

Base class for a custom credential with which the user consented to authenticate to the app.

If you get a `https://developer.android.com/reference/androidx/credentials/CustomCredential` instead of a type-safe credential class such as `https://developer.android.com/reference/androidx/credentials/PasswordCredential`, `https://developer.android.com/reference/androidx/credentials/PublicKeyCredential`, etc., then you should check if you have any other library at interest that supports this custom `https://developer.android.com/reference/androidx/credentials/CustomCredential#(kotlin.String,android.os.Bundle)` of credential, and if so use its parsing utilities to resolve to a type-safe class within that library.

Note: The Bundle keys for `https://developer.android.com/reference/androidx/credentials/CustomCredential#(kotlin.String,android.os.Bundle)` should not be in the form of `androidx.credentials.*` as they are reserved for internal use by this androidx library.

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/credentials/CustomCredential#CustomCredential(kotlin.String,android.os.Bundle)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html type, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html data)` |

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

## Public constructors

### CustomCredential

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

```
public CustomCredential(@NonNull String type, @NonNull Bundle data)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html type` | the credential type determined by the credential-type-specific subclass for custom use cases |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html data` | the credential data in the `https://developer.android.com/reference/android/os/Bundle.html` format for custom use cases (note: bundle keys in the form of `androidx.credentials.*` and `android.credentials.*` are reserved for internal library usage) |