docs-devsite/auth.emailauthprovider.md
Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference
{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}
Provider for generating EmailAuthCredential<!-- -->.
<b>Signature:</b>
export declare class EmailAuthProvider implements AuthProvider
<b>Implements:</b> AuthProvider
| Property | Modifiers | Type | Description |
|---|---|---|---|
| EMAIL_LINK_SIGN_IN_METHOD | <code>static</code> | 'emailLink' | Always set to SignInMethod<!-- -->.EMAIL_LINK. |
| EMAIL_PASSWORD_SIGN_IN_METHOD | <code>static</code> | 'password' | Always set to SignInMethod<!-- -->.EMAIL_PASSWORD. |
| PROVIDER_ID | <code>static</code> | 'password' | Always set to ProviderId<!-- -->.PASSWORD, even for email link. |
| providerId | "password" | Always set to ProviderId<!-- -->.PASSWORD, even for email link. |
| Method | Modifiers | Description |
|---|---|---|
| credential(email, password) | <code>static</code> | Initialize an AuthCredential using an email and password. |
| credentialWithLink(email, emailLink) | <code>static</code> | Initialize an AuthCredential using an email and an email link after a sign in with email link operation. |
Always set to SignInMethod<!-- -->.EMAIL_LINK.
<b>Signature:</b>
static readonly EMAIL_LINK_SIGN_IN_METHOD: 'emailLink';
Always set to SignInMethod<!-- -->.EMAIL_PASSWORD.
<b>Signature:</b>
static readonly EMAIL_PASSWORD_SIGN_IN_METHOD: 'password';
Always set to ProviderId<!-- -->.PASSWORD, even for email link.
<b>Signature:</b>
static readonly PROVIDER_ID: 'password';
Always set to ProviderId<!-- -->.PASSWORD, even for email link.
<b>Signature:</b>
readonly providerId: "password";
Initialize an AuthCredential using an email and password.
<b>Signature:</b>
static credential(email: string, password: string): EmailAuthCredential;
| Parameter | Type | Description |
|---|---|---|
| string | Email address. | |
| password | string | User account password. |
<b>Returns:</b>
The auth provider credential.
const authCredential = EmailAuthProvider.credential(email, password);
const userCredential = await signInWithCredential(auth, authCredential);
const userCredential = await signInWithEmailAndPassword(auth, email, password);
Initialize an AuthCredential using an email and an email link after a sign in with email link operation.
<b>Signature:</b>
static credentialWithLink(email: string, emailLink: string): EmailAuthCredential;
| Parameter | Type | Description |
|---|---|---|
| string | Email address. | |
| emailLink | string | Sign-in email link. |
<b>Returns:</b>
const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink);
const userCredential = await signInWithCredential(auth, authCredential);
await sendSignInLinkToEmail(auth, email);
// Obtain emailLink from user.
const userCredential = await signInWithEmailLink(auth, email, emailLink);