EmailAuthProvider class

Provider for generating EmailAuthCredential.

Signature:

export declare class EmailAuthProvider implements AuthProvider 

Implements: AuthProvider

Properties

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.

Methods

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';

EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD

Always set to SignInMethod.EMAIL_PASSWORD.

Signature:

static readonly EMAIL_PASSWORD_SIGN_IN_METHOD: 'password';

EmailAuthProvider.PROVIDER_ID

Always set to ProviderId.PASSWORD, even for email link.

Signature:

static readonly PROVIDER_ID: 'password';

EmailAuthProvider.providerId

Always set to ProviderId.PASSWORD, even for email link.

Signature:

readonly providerId: "password";

EmailAuthProvider.credential()

Initialize an AuthCredential using an email and password.

Signature:

static credential(email: string, password: string): EmailAuthCredential;

Parameters

Parameter Type Description
email string Email address.
password string User account password.

Returns:

EmailAuthCredential

The auth provider credential.

Example 1

const authCredential = EmailAuthProvider.credential(email, password);
const userCredential = await signInWithCredential(auth, authCredential);

Example 2

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;

Parameters

Parameter Type Description
email string Email address.
emailLink string Sign-in email link.

Returns:

EmailAuthCredential

  • The auth provider credential.

Example 1

const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink);
const userCredential = await signInWithCredential(auth, authCredential);

Example 2

await sendSignInLinkToEmail(auth, email);
// Obtain emailLink from user.
const userCredential = await signInWithEmailLink(auth, email, emailLink);