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.
Signature:
export declare class EmailAuthProvider implements AuthProvider
Implements: AuthProvider
Property | Modifiers | Type | Description |
---|---|---|---|
EMAIL_LINK_SIGN_IN_METHOD | static |
'emailLink' | Always set to SignInMethod.EMAIL_LINK. |
EMAIL_PASSWORD_SIGN_IN_METHOD | static |
'password' | Always set to SignInMethod.EMAIL_PASSWORD. |
PROVIDER_ID | static |
'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) | static |
Initialize an AuthCredential using an email and password. |
credentialWithLink(email, emailLink) | static |
Initialize an AuthCredential using an email and an email link after a sign in with email link operation. |
Always set to SignInMethod.EMAIL_LINK.
Signature:
static readonly EMAIL_LINK_SIGN_IN_METHOD: 'emailLink';
Always set to SignInMethod.EMAIL_PASSWORD.
Signature:
static readonly EMAIL_PASSWORD_SIGN_IN_METHOD: 'password';
Always set to ProviderId.PASSWORD, even for email link.
Signature:
static readonly PROVIDER_ID: 'password';
Always set to ProviderId.PASSWORD, even for email link.
Signature:
readonly providerId: "password";
Initialize an AuthCredential using an email and password.
Signature:
static credential(email: string, password: string): EmailAuthCredential;
Parameter | Type | Description |
---|---|---|
string | Email address. | |
password | string | User account password. |
Returns:
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.
Signature:
static credentialWithLink(email: string, emailLink: string): EmailAuthCredential;
Parameter | Type | Description |
---|---|---|
string | Email address. | |
emailLink | string | Sign-in email link. |
Returns:
- The auth provider credential.
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);