EmailAuthProvider class

用于生成EmailAuthCredential 的提供程序

签名:

export declare class EmailAuthProvider implements AuthProvider 

实现: AuthProvider

特性

财产修饰符类型描述
EMAIL_LINK_SIGN_IN_METHOD static '电子邮件链接'始终设置为SignInMethod .EMAIL_LINK。
EMAIL_PASSWORD_SIGN_IN_METHOD static '密码'始终设置为SignInMethod .EMAIL_PASSWORD。
提供商_ID static '密码'始终设置为ProviderId .PASSWORD,甚至用于电子邮件链接。
提供者ID “密码”始终设置为ProviderId .PASSWORD,甚至用于电子邮件链接。

方法

方法修饰符描述
凭证(电子邮件、密码) static使用电子邮件和密码初始化AuthCredential
credentialWithLink(电子邮件、emailLink) static使用电子邮件链接操作登录后,使用电子邮件和电子邮件链接初始化AuthCredential

始终设置为SignInMethod .EMAIL_LINK。

签名:

static readonly EMAIL_LINK_SIGN_IN_METHOD: 'emailLink';

EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD

始终设置为SignInMethod .EMAIL_PASSWORD。

签名:

static readonly EMAIL_PASSWORD_SIGN_IN_METHOD: 'password';

EmailAuthProvider.PROVIDER_ID

始终设置为ProviderId .PASSWORD,甚至用于电子邮件链接。

签名:

static readonly PROVIDER_ID: 'password';

EmailAuthProvider.providerId

始终设置为ProviderId .PASSWORD,甚至用于电子邮件链接。

签名:

readonly providerId: "password";

EmailAuthProvider.credential()

使用电子邮件和密码初始化AuthCredential

签名:

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

参数

范围类型描述
电子邮件细绳电子邮件地址。
密码细绳用户帐户密码。

返回:

电子邮件验证凭证

身份验证提供者凭证。

实施例1

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

实施例2

const userCredential = await signInWithEmailAndPassword(auth, email, password);

使用电子邮件链接操作登录后,使用电子邮件和电子邮件链接初始化AuthCredential

签名:

static credentialWithLink(email: string, emailLink: string): EmailAuthCredential;

参数

范围类型描述
电子邮件细绳电子邮件地址。
电子邮件链接细绳登录电子邮件链接。

返回:

电子邮件验证凭证

  • 身份验证提供者凭证。

实施例1

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

实施例2

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