# EmailAuthProvider


```
public class EmailAuthProvider
```

<br />

*** ** * ** ***

Represents the email and password authentication mechanism. Use this class to obtain instances of `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/EmailAuthCredential`.

## Summary

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/EmailAuthProvider#EMAIL_LINK_SIGN_IN_METHOD() = "emailLink"` Unique string identifier for email/link sign-in method. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/EmailAuthProvider#EMAIL_PASSWORD_SIGN_IN_METHOD() = "password"` Unique string identifier for email/password sign-in method. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/EmailAuthProvider#PROVIDER_ID() = "password"` Unique string identifier for this provider type. |

| ### Public methods |
|---|---|
| `static @https://developer.android.com/reference/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/auth/AuthCredential` | `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/EmailAuthProvider#getCredential(java.lang.String,java.lang.String)(@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html email, @https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html password)` Returns a new instance of `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/AuthCredential` that wraps a given email and password. |
| `static @https://developer.android.com/reference/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/auth/AuthCredential` | `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/EmailAuthProvider#getCredentialWithLink(java.lang.String,java.lang.String)(@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html email, @https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html emailLink)` Returns a new instance of `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/AuthCredential` that wraps an email sign-in link. |

## Constants

### EMAIL_LINK_SIGN_IN_METHOD

```
public static final String EMAIL_LINK_SIGN_IN_METHOD = "emailLink"
```

Unique string identifier for email/link sign-in method. Indicates the signin methods `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseAuth#signInWithEmailLink(java.lang.String,java.lang.String)` and `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseAuth#signInWithCredential(com.google.firebase.auth.AuthCredential)` with an `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/EmailAuthCredential` generated by `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/EmailAuthProvider#getCredentialWithLink(java.lang.String,java.lang.String)`.

### EMAIL_PASSWORD_SIGN_IN_METHOD

```
public static final String EMAIL_PASSWORD_SIGN_IN_METHOD = "password"
```

Unique string identifier for email/password sign-in method. Indicates the signin methods `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseAuth#signInWithEmailAndPassword(java.lang.String,java.lang.String)` and `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseAuth#signInWithCredential(com.google.firebase.auth.AuthCredential)` with an `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/EmailAuthCredential` generated by `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/EmailAuthProvider#getCredential(java.lang.String,java.lang.String)`.

### PROVIDER_ID

```
public static final String PROVIDER_ID = "password"
```

Unique string identifier for this provider type.

## Public methods

### getCredential

```
public static @NonNull AuthCredential getCredential(@NonNull String email, @NonNull String password)
```

Returns a new instance of `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/AuthCredential` that wraps a given email and password. Used when calling `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseAuth#signInWithCredential(com.google.firebase.auth.AuthCredential)` or `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseUser#linkWithCredential(com.google.firebase.auth.AuthCredential)`.

### getCredentialWithLink

```
public static @NonNull AuthCredential getCredentialWithLink(@NonNull String email, @NonNull String emailLink)
```

Returns a new instance of `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/AuthCredential` that wraps an email sign-in link. Used when calling `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseAuth#signInWithCredential(com.google.firebase.auth.AuthCredential)` or `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseUser#linkWithCredential(com.google.firebase.auth.AuthCredential)`.
Exceptions

- `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` thrown if the `emailLink` doesn't conform to the expectations checked in `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseAuth#isSignInWithEmailLink(java.lang.String)`

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html email` | the email to which the `emailLink` was sent |
| `@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html emailLink` | a link generated by `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseAuth#sendSignInLinkToEmail(java.lang.String,com.google.firebase.auth.ActionCodeSettings)` |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/auth/AuthCredential` | an `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/AuthCredential` that wraps the given `email` and `emailLink`. Used when calling `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseAuth#signInWithCredential(com.google.firebase.auth.AuthCredential)`, `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseUser#linkWithCredential(com.google.firebase.auth.AuthCredential)`, or `https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseUser#reauthenticate(com.google.firebase.auth.AuthCredential)`. |