auth package

Firebase 身份验证

功能

功能描述
函数(应用程序,...)
获取身份验证(应用程序)返回与提供的FirebaseApp关联的 Auth 实例。如果不存在实例,则使用特定于平台的默认依赖项初始化 Auth 实例。
初始化Auth(应用程序,部门)通过对依赖项的细粒度控制来初始化Auth实例
功能(存储,...)
获取ReactNativePersistence(存储)返回一个持久化对象,该对象包装从react-native@react-native-community/async-storage导入的AsyncStorage ,并且可以在initializeAuth()中的持久化依赖字段中使用
函数(验证,...)
applyActionCode(身份验证,oobCode)应用通过电子邮件或其他带外机制发送给用户的验证码。
beforeAuthStateChanged(身份验证,回调,onAbort)添加在身份验证状态更改设置新用户之前运行的阻止回调。
检查操作代码(验证,oobCode)检查通过电子邮件或其他带外机制发送给用户的验证码。
确认密码重置(身份验证,oobCode,新密码)给出确认码和新密码后,完成密码重置过程。
connectAuthEmulator(身份验证,网址,选项)更改Auth实例以与 Firebase Auth 模拟器(而不是生产 Firebase Auth 服务)进行通信。
createUserWithEmailAndPassword(身份验证、电子邮件、密码)创建与指定的电子邮件地址和密码关联的新用户帐户。
fetchSignInMethodsForEmail(身份验证,电子邮件)获取给定电子邮件地址的可能登录方法列表。当启用[电子邮件枚举保护](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection)时,无论可用于多少种身份验证方法,此方法都会返回一个空列表。给定的电子邮件。
getMultiFactorResolver(验证,错误)提供适合完成多因素流的MultiFactorResolver
getRedirectResult(身份验证,解析器)从基于重定向的登录流程返回UserCredential
初始化RecaptchaConfig(身份验证)将 reCAPTCHA 配置加载到Auth实例中。
isSignInWithEmailLink(auth, emailLink)检查传入链接是否是适合signInWithEmailLink()的电子邮件登录链接
onAuthStateChanged(auth,nextOrObserver,错误,已完成)添加观察者以观察用户登录状态的变化。
onIdTokenChanged(auth,nextOrObserver,错误,已完成)添加一个观察者以监视登录用户的 ID 令牌的更改。
撤销AccessToken(身份验证,令牌)撤销给定的访问令牌。目前仅支持 Apple OAuth 访问令牌。
发送密码重置电子邮件(身份验证、电子邮件、actionCodeSettings)将密码重置电子邮件发送到给定的电子邮件地址。当没有具有给定电子邮件地址的用户帐户并且启用了[电子邮件枚举保护](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection)时,此方法不会引发错误。
sendSignInLinkToEmail(身份验证、电子邮件、actionCodeSettings)使用指定电子邮件向用户发送登录电子邮件链接。
setPersistence(身份验证,持久性)更改当前保存的Auth会话的Auth实例上的持久性类型,并将此类型的持久性应用于将来的登录请求,包括使用重定向请求登录。
匿名登录(auth)以匿名用户身份异步登录。
SignInWithCredential(身份验证,凭据)使用给定的凭据异步登录。
SignInWithCustomToken(身份验证,customToken)使用自定义令牌异步登录。
SignInWithEmailAndPassword(身份验证、电子邮件、密码)使用电子邮件和密码异步登录。
SignInWithEmailLink(身份验证、电子邮件、emailLink)使用电子邮件和登录电子邮件链接异步登录。
SignInWithPhoneNumber(auth, 电话号码, appVerifier)使用电话号码异步登录。
SignInWithPopup(身份验证、提供者、解析器)使用基于弹出窗口的 OAuth 身份验证流程对 Firebase 客户端进行身份验证。
SignInWithRedirect(身份验证、提供者、解析器)使用全页面重定向流对 Firebase 客户端进行身份验证。
退出(验证)注销当前用户。
更新当前用户(身份验证,用户)Auth实例上异步将提供的用户设置为Auth.currentUser
使用设备语言(auth)将当前语言设置为默认设备/浏览器首选项。
验证密码(身份验证,密码)根据为项目或租户配置的密码策略验证密码。
验证密码重置代码(身份验证,代码)检查通过电子邮件或其他带外机制发送给用户的密码重置代码。
函数(链接,...)
解析ActionCodeURL(链接)解析电子邮件操作链接字符串,如果链接有效,则返回ActionCodeURL ,否则返回 null。
函数(用户,...)
删除用户(用户)删除并注销用户。
getIdToken(用户,强制刷新)返回用于向 Firebase 服务识别用户的 JSON Web 令牌 (JWT)。
getIdTokenResult(用户,强制刷新)返回反序列化的 JSON Web 令牌 (JWT),用于向 Firebase 服务识别用户。
linkWithCredential(用户,凭据)将用户帐户与给定的凭据链接起来。
linkWithPhoneNumber(用户,电话号码,appVerifier)将用户帐户与给定的电话号码链接。
linkWithPopup(用户,提供者,解析器)使用基于弹出的 OAuth 流程将经过身份验证的提供商链接到用户帐户。
linkWithRedirect(用户,提供者,解析器)使用全页重定向流将OAuthProvider链接到用户帐户。
多因素(用户)用户对应的MultiFactorUser
reauthenticateWithCredential(用户,凭据)使用新的凭据重新验证用户身份。
reauthenticateWithPhoneNumber(用户,电话号码,appVerifier)使用新的电话凭证重新验证用户身份。
reauthenticateWithPopup(用户、提供者、解析器)使用基于弹出窗口的 OAuth 流程通过指定的OAuthProvider重新验证当前用户。
reauthenticateWithRedirect(用户、提供者、解析器)使用全页重定向流通过指定的OAuthProvider重新验证当前用户。
重新加载(用户)如果已登录,则重新加载用户帐户数据。
发送电子邮件验证(用户,actionCodeSettings)向用户发送验证电子邮件。
取消链接(用户,提供商 ID)取消提供商与用户帐户的链接。
更新电子邮件(用户,新电子邮件)更新用户的电子邮件地址。
更新密码(用户,新密码)更新用户的密码。
更新电话号码(用户,凭据)更新用户的电话号码。
updateProfile(用户, { 显示名称, photoURL: photoUrl })更新用户的个人资料数据。
verifyBeforeUpdateEmail(用户,新电子邮件,actionCodeSettings)向新电子邮件地址发送验证电子邮件。
函数(用户凭证,...)
获取附加用户信息(用户凭证)提取给定凭证的提供者特定的AdditionalUserInfo

课程

班级描述
动作代码URL用于解析电子邮件操作 URL(例如密码重置、电子邮件验证、电子邮件链接登录等)的实用程序类。
验证凭证表示AuthProvider返回的凭据的接口
电子邮件验证凭证表示EmailAuthProvider返回的ProviderId凭据的接口。密码
电子邮件验证提供者用于生成EmailAuthCredential 的提供程序
FacebookAuthProvider用于为ProviderId生成OAuthCredential 的提供程序。FACEBOOK。
GithubAuthProvider用于为ProviderId生成OAuthCredential 的提供程序.GITHUB。
谷歌认证提供者用于为ProviderId生成OAuthCredential 的提供程序。谷歌。
OAuth凭证表示OAuthProvider返回的 OAuth 凭据
OAuth提供者用于生成通用OAuthCredential的提供程序
电话验证凭证表示PhoneAuthProvider返回的凭证
电话验证提供者用于生成PhoneAuthCredential 的提供程序
电话多因素发生器用于生成PhoneMultiFactorAssertion的提供程序
验证码验证器验证码基于应用程序的验证器。
SAMLAuthProvider SAML 的AuthProvider
托普多因素发生器用于生成TotpMultiFactorAssertion 的提供程序
顶级秘密用于生成TotpMultiFactorAssertion 的提供程序存储共享密钥和其他参数以生成基于时间的 OTP。实现检索共享密钥并生成 QR 码 URL 的方法。
TwitterAuthProvider用于为ProviderId生成OAuthCredential 的提供程序。推特。

接口

界面描述
动作代码信息checkActionCode()的响应
动作代码设置一个接口,使用可选的 Android 和 iOS 包标识符定义所需的继续/状态 URL。
附加用户信息包含来自联合身份提供商的附加用户信息的结构。
应用验证器用于域验证和滥用预防的验证程序。
授权代表 Firebase Auth 服务的接口。
验证错误Auth错误的接口。
验证错误映射表错误代码到错误消息的映射。
认证提供者代表身份验证提供者的接口,用于方便创建AuthCredential
验证设置代表Auth实例设置的接口。
配置代表Auth验证配置的接口。
确认结果电话号码登录、链接或重新验证呼叫的结果。
依赖关系可用于初始化Auth实例的依赖项。
模拟器配置Firebase 身份验证模拟器的配置。
IdToken结果表示从User.getIdTokenResult()获取的 ID 令牌结果的接口
多因素断言用于声明第二个因素的所有权的基类。
多因素错误当用户需要提供第二个因素才能成功登录时引发的错误。
多因素信息包含第二因素实体信息的结构。
多因素解析器当用户需要提供第二个因素进行登录时,该类可帮助从MultiFactorError中恢复。
多因素会话定义多因素会话对象的接口,用于注册用户的第二因素或帮助使用第二因素登录已注册的用户。
多因素用户定义与用户相关的多因素相关属性和操作的接口
OAuth凭据选项定义用于初始化OAuthCredential 的选项
解析令牌表示已解析 ID 令牌的接口。
密码策略指定密码策略要求的结构。
密码验证状态指示满足或违反哪些密码策略要求以及要求是什么的结构。
坚持涵盖可能的持久性机制类型的接口。
电话多因素断言用于声明电话所有权的类是第二个因素。由PhoneMultiFactorGenerator.assertion()提供
电话多因素注册信息选项用于注册第二个因素的选项。
电话多因素信息电话号码第二因素的MultiFactorInfo接口的子类。第二个因素的factorIdFactorId 。电话。
电话多重登录信息选项用于使用第二因素登录的选项。
电话单因素信息选项用于单因素登录的选项。
弹出重定向解析器用于处理 DOM 特定操作的解析器,例如signInWithPopup()signInWithRedirect()
ReactNativeAsyncStorage提供的AsyncStorage的接口。
验证码参数表示 reCAPTCHA 参数的接口。有关可接受参数的列表,请参阅 [reCAPTCHA 文档](https://developers.google.com/recaptcha/docs/display#render_param)。除sitekey之外的所有参数均被接受:Firebase Auth 为每个项目提供 reCAPTCHA,并将在渲染时配置站点密钥。对于不可见的 reCAPTCHA,请将size键设置为invisible
顶部多因素断言用于断言 TOTP 第二个因素的所有权的类。由TotpMultiFactorGenerator.assertionForEnrollment()TotpMultiFactorGenerator.assertionForSignIn()提供
顶部多因素信息TOTP 第二因素的MultiFactorInfo接口的子类。第二个因素的factorIdFactorId .TOTP。
用户一个用户帐户。
用户凭证包含用户的结构,操作类型,以及提供商 ID。
用户信息用户个人资料信息,仅对 Firebase 项目的应用可见。
用户元数据代表用户元数据的接口。

变量

多变的描述
动作代码操作可能的电子邮件操作类型的枚举。
验证错误代码潜在的Auth错误代码的映射,以便更轻松地与 SDK 引发的错误进行比较。
浏览器本地持久化使用localStorage作为底层存储的LOCAL类型持久化的实现。
浏览器弹出重定向解析器PopupRedirectResolver的实现适用于基于浏览器的应用程序。
浏览器会话持久化使用sessionStorage作为底层存储的SESSION持久化的实现。
cordovaPopupRedirectResolver适用于基于 Cordova 的应用程序的PopupRedirectResolver实现。
调试错误映射表详细的错误图,包含大多数错误代码的详细描述。请参阅AuthErrorMap中的讨论
因子ID可用于多因素身份验证的因素的枚举。
索引数据库本地持久化使用indexedDB作为底层存储的LOCAL类型持久化的实现。
内存持久化“NONE”类型持久化的实现。
操作类型支持的操作类型的枚举。
产品错误图删除了所有详细错误消息的最小错误图。请参阅AuthErrorMap中的讨论
提供商ID支持的提供者的枚举。
登录方法支持的登录方法的枚举。

类型别名

类型别名描述
自定义参数OAuth 自定义参数映射。
下一个或观察者事件回调的类型定义。
电话信息选项验证电话号码所有权所需的信息。
用户资料AdditionalUserInfo中使用的用户配置文件

函数(应用程序,...)

获取身份验证(应用程序)

返回与提供的FirebaseApp关联的 Auth 实例。如果不存在实例,则使用特定于平台的默认依赖项初始化 Auth 实例。

签名:

export declare function getAuth(app?: FirebaseApp): Auth;

参数

范围类型描述
应用程序Firebase应用程序Firebase 应用程序。

返回:

授权

初始化Auth(应用程序,部门)

通过对依赖项的细粒度控制来初始化Auth实例

getAuth()相比,此函数允许对Auth实例进行更多控制getAuth使用特定于平台的默认值来提供依赖项。一般来说, getAuth是初始化 Auth 的最简单方法,适用于大多数用例。如果您需要控制使用哪个持久层,请使用initializeAuth ,或者如果您不使用signInWithPopupsignInWithRedirect ,请使用initializeAuth来最小化包大小

例如,如果您的应用程序仅使用匿名帐户,并且您只想保存当前会话的帐户,请使用以下命令初始化Auth

const auth = initializeAuth(app, {
  persistence: browserSessionPersistence,
  popupRedirectResolver: undefined,
});

签名:

export declare function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth;

参数

范围类型描述
应用程序Firebase应用程序
部门依赖关系

返回:

授权

功能(存储,...)

获取ReactNativePersistence(存储)

返回一个持久化对象,该对象包装从react-native@react-native-community/async-storage导入的AsyncStorage ,并且可以在initializeAuth()中的持久性依赖字段中使用

签名:

export declare function getReactNativePersistence(storage: ReactNativeAsyncStorage): Persistence;

参数

范围类型描述
贮存ReactNativeAsyncStorage

返回:

坚持

函数(验证,...)

applyActionCode(身份验证,oobCode)

应用通过电子邮件或其他带外机制发送给用户的验证码。

签名:

export declare function applyActionCode(auth: Auth, oobCode: string): Promise<void>;

参数

范围类型描述
授权授权Auth实例。
出库代码细绳发送给用户的验证码。

返回:

承诺<无效>

beforeAuthStateChanged(身份验证,回调,onAbort)

添加在身份验证状态更改设置新用户之前运行的阻止回调。

签名:

export declare function beforeAuthStateChanged(auth: Auth, callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe;

参数

范围类型描述
授权授权Auth实例。
打回来(用户:用户| null)=> void |承诺<无效>设置新用户值之前触发的回调。如果抛出此异常,则会阻止用户被设置。
中止时() => 无效如果稍后的beforeAuthStateChanged()回调抛出,则会触发回调,允许您撤消任何副作用。

返回:

退订

检查操作代码(验证,oobCode)

检查通过电子邮件或其他带外机制发送给用户的验证码。

签名:

export declare function checkActionCode(auth: Auth, oobCode: string): Promise<ActionCodeInfo>;

参数

范围类型描述
授权授权Auth实例。
出库代码细绳发送给用户的验证码。

返回:

Promise< ActionCodeInfo >

有关代码的元数据。

确认密码重置(身份验证,oobCode,新密码)

给出确认码和新密码后,完成密码重置过程。

签名:

export declare function confirmPasswordReset(auth: Auth, oobCode: string, newPassword: string): Promise<void>;

参数

范围类型描述
授权授权Auth实例。
出库代码细绳发送给用户的确认码。
新密码细绳新密码。

返回:

承诺<无效>

connectAuthEmulator(身份验证,网址,选项)

更改Auth实例以与 Firebase Auth 模拟器(而不是生产 Firebase Auth 服务)进行通信。

必须在第一次调用initializeAuth()之后立即同步调用。请勿与生产凭据一起使用,因为模拟器流量未加密。

签名:

export declare function connectAuthEmulator(auth: Auth, url: string, options?: {
    disableWarnings: boolean;
}): void;

参数

范围类型描述
授权授权Auth实例。
网址细绳运行模拟器的 URL(例如“http://localhost:9099”)。
选项{ 禁用警告:布尔值; }选修的。 options.disableWarnings默认为false 。将其设置为true以禁用附加到 DOM 的警告横幅。

返回:

空白

例子

connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true });

createUserWithEmailAndPassword(身份验证、电子邮件、密码)

创建与指定的电子邮件地址和密码关联的新用户帐户。

成功创建用户帐户后,该用户也将登录到您的应用程序。

如果帐户已存在或密码无效,用户帐户创建可能会失败。

签名:

export declare function createUserWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>;

参数

范围类型描述
授权授权Auth实例。
电子邮件细绳用户的电子邮件地址。
密码细绳用户选择的密码。

返回:

承诺<用户凭证>

fetchSignInMethodsForEmail(身份验证,电子邮件)

获取给定电子邮件地址的可能登录方法列表。当启用[电子邮件枚举保护](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection)时,无论可用于多少种身份验证方法,此方法都会返回一个空列表。给定的电子邮件。

这对于区分同一提供商的登录方法很有用,例如。 EmailAuthProvider有 2 种登录方法, SignInMethod .EMAIL_PASSWORD 和SignInMethod .EMAIL_LINK。

签名:

export declare function fetchSignInMethodsForEmail(auth: Auth, email: string): Promise<string[]>;

参数

范围类型描述
授权授权Auth实例。
电子邮件细绳用户的电子邮件地址。已弃用。建议放弃此方法作为安全最佳实践。有关详细信息,请参阅 Identity Platform 文档中的 [电子邮件枚举保护](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection)。

返回:

承诺<字符串[]>

getMultiFactorResolver(验证,错误)

提供适合完成多因素流的MultiFactorResolver

签名:

export declare function getMultiFactorResolver(auth: Auth, error: MultiFactorError): MultiFactorResolver;

参数

范围类型描述
授权授权Auth实例。
错误多因素错误在登录或重新身份验证操作期间引发的MultiFactorError

返回:

多因素解析器

getRedirectResult(身份验证,解析器)

从基于重定向的登录流程返回UserCredential

如果登录成功,则返回登录的用户。如果登录不成功,则会失败并出现错误。如果没有调用重定向操作,则返回null

此方法不适用于 Node.js 环境。

签名:

export declare function getRedirectResult(auth: Auth, resolver?: PopupRedirectResolver): Promise<UserCredential | null>;

参数

范围类型描述
授权授权Auth实例。
解析器弹出重定向解析器PopupRedirectResolver的实例,如果已提供给initializeAuth()或由getAuth()提供,则为可选

返回:

承诺<用户凭证|空>

例子

// Sign in using a redirect.
const provider = new FacebookAuthProvider();
// You can add additional scopes to the provider:
provider.addScope('user_birthday');
// Start a sign in process for an unauthenticated user.
await signInWithRedirect(auth, provider);
// This will trigger a full page redirect away from your app

// After returning from the redirect when your app initializes you can obtain the result
const result = await getRedirectResult(auth);
if (result) {
  // This is the signed-in user
  const user = result.user;
  // This gives you a Facebook Access Token.
  const credential = provider.credentialFromResult(auth, result);
  const token = credential.accessToken;
}
// As this API can be used for sign-in, linking and reauthentication,
// check the operationType to determine what triggered this redirect
// operation.
const operationType = result.operationType;

初始化RecaptchaConfig(身份验证)

将 reCAPTCHA 配置加载到Auth实例中。

这会将 reCAPTCHA 配置加载到当前的 Auth 会话中,该配置指示是否应为每个身份验证提供程序触发 reCAPTCHA 验证流程。

如果不调用initializeRecaptchaConfig(),则身份验证流程将始终在没有 reCAPTCHA 验证的情况下启动。如果提供商配置为需要 reCAPTCHA 验证,则 SDK 将透明地加载 reCAPTCHA 配置并重新启动身份验证流程。

因此,通过调用此可选方法,您将减少未来身份验证流程的延迟。尽早加载 reCAPTCHA 配置还将增强 reCAPTCHA 收集的信号。

此方法不适用于 Node.js 环境。

签名:

export declare function initializeRecaptchaConfig(auth: Auth): Promise<void>;

参数

范围类型描述
授权授权Auth实例。

返回:

承诺<无效>

例子

initializeRecaptchaConfig(auth);

检查传入链接是否是适合signInWithEmailLink()的电子邮件登录链接

签名:

export declare function isSignInWithEmailLink(auth: Auth, emailLink: string): boolean;

参数

范围类型描述
授权授权Auth实例。
电子邮件链接细绳发送到用户电子邮件地址的链接。

返回:

布尔值

onAuthStateChanged(auth,nextOrObserver,错误,已完成)

添加观察者以观察用户登录状态的变化。

要保留旧行为,请参阅onIdTokenChanged()

签名:

export declare function onAuthStateChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;

参数

范围类型描述
授权授权Auth实例。
下一个或观察者下一个或观察者<用户>更改时触发回调。
错误错误Fn已弃用。这个回调永远不会被触发。登录/注销时的错误可以在从登录/注销函数返回的承诺中捕获。
完全的完整Fn已弃用。这个回调永远不会被触发。

返回:

退订

onIdTokenChanged(身份验证,nextOrObserver,错误,已完成)

添加一个观察者以监视登录用户的 ID 令牌的更改。

这包括登录、注销和令牌刷新事件。 ID 令牌过期后不会自动触发。使用User.getIdToken()刷新 ID 令牌。

签名:

export declare function onIdTokenChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;

参数

范围类型描述
授权授权Auth实例。
下一个或观察者下一个或观察者<用户>更改时触发回调。
错误错误Fn已弃用。这个回调永远不会被触发。登录/注销时的错误可以在从登录/注销函数返回的承诺中捕获。
完全的完整Fn已弃用。这个回调永远不会被触发。

返回:

退订

撤销AccessToken(身份验证,令牌)

撤销给定的访问令牌。目前仅支持 Apple OAuth 访问令牌。

签名:

export declare function revokeAccessToken(auth: Auth, token: string): Promise<void>;

参数

范围类型描述
授权授权Auth实例。
代币细绳Apple OAuth 访问令牌。

返回:

承诺<无效>

发送密码重置电子邮件(身份验证、电子邮件、actionCodeSettings)

将密码重置电子邮件发送到给定的电子邮件地址。当没有具有给定电子邮件地址的用户帐户并且启用了[电子邮件枚举保护](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection)时,此方法不会引发错误。

要完成密码重置,请使用发送给用户的电子邮件中提供的代码以及用户指定的新密码来调用confirmPasswordReset()

签名:

export declare function sendPasswordResetEmail(auth: Auth, email: string, actionCodeSettings?: ActionCodeSettings): Promise<void>;

参数

范围类型描述
授权授权Auth实例。
电子邮件细绳用户的电子邮件地址。
动作代码设置动作代码设置动作代码设置

返回:

承诺<无效>

例子

const actionCodeSettings = {
  url: 'https://www.example.com/?email=user@example.com',
  iOS: {
     bundleId: 'com.example.ios'
  },
  android: {
    packageName: 'com.example.android',
    installApp: true,
    minimumVersion: '12'
  },
  handleCodeInApp: true
};
await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings);
// Obtain code from user.
await confirmPasswordReset('user@example.com', code);

sendSignInLinkToEmail(身份验证、电子邮件、actionCodeSettings)

使用指定电子邮件向用户发送登录电子邮件链接。

与其他带外电子邮件操作(密码重置和电子邮件验证)不同,登录操作必须始终在应用程序中完成。这是因为,在流程结束时,用户应该登录并且他们的身份验证状态会保留在应用程序中。

要使用电子邮件链接完成登录,请使用发送给用户的电子邮件中提供的电子邮件地址和电子邮件链接来调用signInWithEmailLink()

签名:

export declare function sendSignInLinkToEmail(auth: Auth, email: string, actionCodeSettings: ActionCodeSettings): Promise<void>;

参数

范围类型描述
授权授权
电子邮件细绳用户的电子邮件地址。
动作代码设置动作代码设置动作代码设置

返回:

承诺<无效>

例子

const actionCodeSettings = {
  url: 'https://www.example.com/?email=user@example.com',
  iOS: {
     bundleId: 'com.example.ios'
  },
  android: {
    packageName: 'com.example.android',
    installApp: true,
    minimumVersion: '12'
  },
  handleCodeInApp: true
};
await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);
// Obtain emailLink from the user.
if(isSignInWithEmailLink(auth, emailLink)) {
  await signInWithEmailLink(auth, 'user@example.com', emailLink);
}

setPersistence(身份验证,持久性)

更改当前保存的Auth会话的Auth实例上的持久性类型,并将此类型的持久性应用于将来的登录请求,包括使用重定向请求登录。

这使得登录的用户可以轻松指定是否应记住其会话。它还可以更轻松地永远不会保留其他用户共享或具有敏感数据的应用程序的Auth状态。

此方法不适用于 Node.js 环境。

签名:

export declare function setPersistence(auth: Auth, persistence: Persistence): Promise<void>;

参数

范围类型描述
授权授权Auth实例。
坚持坚持坚持使用。

返回:

承诺<无效>

持久性更改完成后即可解决的Promise

例子

setPersistence(auth, browserSessionPersistence);

匿名登录(auth)

以匿名用户身份异步登录。

如果已经有匿名用户登录,则返回该用户;否则,将创建并返回一个新的匿名用户身份。

签名:

export declare function signInAnonymously(auth: Auth): Promise<UserCredential>;

参数

范围类型描述
授权授权Auth实例。

返回:

承诺<用户凭证>

SignInWithCredential(身份验证,凭据)

使用给定的凭据异步登录。

AuthProvider可用于生成凭证。

签名:

export declare function signInWithCredential(auth: Auth, credential: AuthCredential): Promise<UserCredential>;

参数

范围类型描述
授权授权Auth实例。
凭据验证凭证授权凭证。

返回:

承诺<用户凭证>

SignInWithCustomToken(身份验证,customToken)

使用自定义令牌异步登录。

自定义令牌用于将 Firebase Auth 与现有身份验证系统集成,并且必须由身份验证后端使用Admin SDK中的createCustomToken方法生成。

如果令牌无效、过期或不被 Firebase Auth 服务接受,则会失败并显示错误。

签名:

export declare function signInWithCustomToken(auth: Auth, customToken: string): Promise<UserCredential>;

参数

范围类型描述
授权授权Auth实例。
自定义令牌细绳用于登录的自定义令牌。

返回:

承诺<用户凭证>

SignInWithEmailAndPassword(身份验证、电子邮件、密码)

使用电子邮件和密码异步登录。

如果电子邮件地址和密码不匹配,则会失败并显示错误。启用[电子邮件枚举保护](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) 后,如果无效,此方法会失败并显示“auth/invalid-credential”电子邮件/密码。

签名:

export declare function signInWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>;

参数

范围类型描述
授权授权Auth实例。
电子邮件细绳用户的电子邮件地址。
密码细绳用户密码。

返回:

承诺<用户凭证>

使用电子邮件和登录电子邮件链接异步登录。

如果未传递链接,则从当前 URL 推断链接。

如果电子邮件地址无效或电子邮件链接中的 OTP 过期,则会失败并显示错误。

签名:

export declare function signInWithEmailLink(auth: Auth, email: string, emailLink?: string): Promise<UserCredential>;

参数

范围类型描述
授权授权Auth实例。
电子邮件细绳用户的电子邮件地址。
电子邮件链接细绳发送到用户电子邮件地址的链接。

返回:

承诺<用户凭证>

例子

const actionCodeSettings = {
  url: 'https://www.example.com/?email=user@example.com',
  iOS: {
     bundleId: 'com.example.ios'
  },
  android: {
    packageName: 'com.example.android',
    installApp: true,
    minimumVersion: '12'
  },
  handleCodeInApp: true
};
await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);
// Obtain emailLink from the user.
if(isSignInWithEmailLink(auth, emailLink)) {
  await signInWithEmailLink(auth, 'user@example.com', emailLink);
}

SignInWithPhoneNumber(auth, 电话号码, appVerifier)

使用电话号码异步登录。

此方法通过短信发送代码到给定的电话号码,并返回一个ConfirmationResult 。用户提供发送到手机的代码后,使用该代码调用ConfirmationResult.confirm()以使用户登录。

为了防止滥用,此方法还需要一个ApplicationVerifier 。该 SDK 包括基于 reCAPTCHA 的实现RecaptchaVerifier 。此功能可以在不支持RecaptchaVerifier 的其他平台(如 React Native)上工作,但您需要使用第三方ApplicationVerifier实现。

此方法不适用于 Node.js 环境。

签名:

export declare function signInWithPhoneNumber(auth: Auth, phoneNumber: string, appVerifier: ApplicationVerifier): Promise<ConfirmationResult>;

参数

范围类型描述
授权授权Auth实例。
电话号码细绳E.164 格式的用户电话号码(例如+16505550101)。
应用程序验证器应用验证器应用程序验证器

返回:

承诺<确认结果>

例子

// 'recaptcha-container' is the ID of an element in the DOM.
const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');
const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
// Obtain a verificationCode from the user.
const credential = await confirmationResult.confirm(verificationCode);

SignInWithPopup(身份验证、提供者、解析器)

使用基于弹出窗口的 OAuth 身份验证流程对 Firebase 客户端进行身份验证。

如果成功,则返回登录用户以及提供商的凭据。如果登录不成功,则返回一个错误对象,其中包含有关该错误的其他信息。

此方法不适用于 Node.js 环境。

签名:

export declare function signInWithPopup(auth: Auth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>;

参数

范围类型描述
授权授权Auth实例。
提供者认证提供者提供者进行身份验证。提供者必须是OAuthProvider 。非 OAuth 提供商(例如EmailAuthProvider)将引发错误。
解析器弹出重定向解析器PopupRedirectResolver的实例,如果已提供给initializeAuth()或由getAuth()提供,则为可选

返回:

承诺<用户凭证>

例子

// Sign in using a popup.
const provider = new FacebookAuthProvider();
const result = await signInWithPopup(auth, provider);

// The signed-in user info.
const user = result.user;
// This gives you a Facebook Access Token.
const credential = provider.credentialFromResult(auth, result);
const token = credential.accessToken;

SignInWithRedirect(身份验证、提供者、解析器)

使用全页面重定向流对 Firebase 客户端进行身份验证。

要处理此操作的结果和错误,请参考getRedirectResult() 。使用signInWithRedirect()时遵循最佳实践

此方法不适用于 Node.js 环境。

签名:

export declare function signInWithRedirect(auth: Auth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;

参数

范围类型描述
授权授权Auth实例。
提供者认证提供者提供者进行身份验证。提供者必须是OAuthProvider 。非 OAuth 提供商(例如EmailAuthProvider)将引发错误。
解析器弹出重定向解析器PopupRedirectResolver的实例,如果已提供给initializeAuth()或由getAuth()提供,则为可选

返回:

承诺<从不>

例子

// Sign in using a redirect.
const provider = new FacebookAuthProvider();
// You can add additional scopes to the provider:
provider.addScope('user_birthday');
// Start a sign in process for an unauthenticated user.
await signInWithRedirect(auth, provider);
// This will trigger a full page redirect away from your app

// After returning from the redirect when your app initializes you can obtain the result
const result = await getRedirectResult(auth);
if (result) {
  // This is the signed-in user
  const user = result.user;
  // This gives you a Facebook Access Token.
  const credential = provider.credentialFromResult(auth, result);
  const token = credential.accessToken;
}
// As this API can be used for sign-in, linking and reauthentication,
// check the operationType to determine what triggered this redirect
// operation.
const operationType = result.operationType;

退出(验证)

注销当前用户。

签名:

export declare function signOut(auth: Auth): Promise<void>;

参数

范围类型描述
授权授权Auth实例。

返回:

承诺<无效>

更新当前用户(身份验证,用户)

Auth实例上异步将提供的用户设置为Auth.currentUser

将创建所提供用户的新实例副本并将其设置为 currentUser。

与其他登录方法一样,这将触发onAuthStateChanged()onIdTokenChanged()侦听器。

如果要更新的用户属于不同的 Firebase 项目,则操作会失败并出现错误。

签名:

export declare function updateCurrentUser(auth: Auth, user: User | null): Promise<void>;

参数

范围类型描述
授权授权Auth实例。
用户用户|无效的用户

返回:

承诺<无效>

使用设备语言(auth)

将当前语言设置为默认设备/浏览器首选项。

签名:

export declare function useDeviceLanguage(auth: Auth): void;

参数

范围类型描述
授权授权Auth实例。

返回:

空白

验证密码(身份验证,密码)

根据为项目或租户配置的密码策略验证密码。

如果Auth实例上没有设置租户ID,则此方法将使用为项目配置的密码策略。否则,此方法将使用为租户配置的策略。如果尚未配置密码策略,则将使用为所有项目配置的默认策略。

如果由于提交的密码不符合密码策略要求而导致身份验证流程失败,并且之前已调用此方法,则再次调用时此方法将使用最新的可用策略。

签名:

export declare function validatePassword(auth: Auth, password: string): Promise<PasswordValidationStatus>;

参数

范围类型描述
授权授权Auth实例。
密码细绳要验证的密码。

返回:

Promise<密码验证状态>

例子

validatePassword(auth, 'some-password');

验证密码重置代码(身份验证,代码)

检查通过电子邮件或其他带外机制发送给用户的密码重置代码。

签名:

export declare function verifyPasswordResetCode(auth: Auth, code: string): Promise<string>;

参数

范围类型描述
授权授权Auth实例。
代码细绳发送给用户的验证码。

返回:

承诺<字符串>

用户的电子邮件地址(如果有效)。

解析ActionCodeURL(链接)

解析电子邮件操作链接字符串,如果链接有效,则返回ActionCodeURL ,否则返回 null。

签名:

export declare function parseActionCodeURL(link: string): ActionCodeURL | null;

参数

范围类型描述
关联细绳

返回:

操作代码URL |无效的

函数(用户,...)

删除用户(用户)

删除并注销用户。

签名:

export declare function deleteUser(user: User): Promise<void>;

参数

范围类型描述
用户用户用户。

返回:

承诺<无效>

getIdToken(用户,强制刷新)

返回用于向 Firebase 服务识别用户的 JSON Web 令牌 (JWT)。

如果当前令牌尚未过期或在接下来的五分钟内不会过期,则返回当前令牌。否则,这将刷新令牌并返回一个新令牌。

签名:

export declare function getIdToken(user: User, forceRefresh?: boolean): Promise<string>;

参数

范围类型描述
用户用户用户。
强制刷新布尔值无论令牌是否过期,都强制刷新。

返回:

承诺<字符串>

getIdTokenResult(用户,强制刷新)

返回反序列化的 JSON Web 令牌 (JWT),用于向 Firebase 服务识别用户。

如果当前令牌尚未过期或在接下来的五分钟内不会过期,则返回当前令牌。否则,这将刷新令牌并返回一个新令牌。

签名:

export declare function getIdTokenResult(user: User, forceRefresh?: boolean): Promise<IdTokenResult>;

参数

范围类型描述
用户用户用户。
强制刷新布尔值无论令牌是否过期,都强制刷新。

返回:

Promise< IdTokenResult >

linkWithCredential(用户,凭据)

将用户帐户与给定的凭据链接起来。

AuthProvider可用于生成凭证。

签名:

export declare function linkWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>;

参数

范围类型描述
用户用户用户。
凭据验证凭证授权凭证。

返回:

承诺<用户凭证>

linkWithPhoneNumber(用户,电话号码,appVerifier)

将用户帐户与给定的电话号码链接。

此方法不适用于 Node.js 环境。

签名:

export declare function linkWithPhoneNumber(user: User, phoneNumber: string, appVerifier: ApplicationVerifier): Promise<ConfirmationResult>;

参数

范围类型描述
用户用户用户。
电话号码细绳E.164 格式的用户电话号码(例如+16505550101)。
应用程序验证器应用验证器应用程序验证器

返回:

承诺<确认结果>

linkWithPopup(用户,提供者,解析器)

使用基于弹出的 OAuth 流程将经过身份验证的提供商链接到用户帐户。

如果链接成功,返回的结果将包含用户和提供商的凭据。

此方法不适用于 Node.js 环境。

签名:

export declare function linkWithPopup(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>;

参数

范围类型描述
用户用户用户。
提供者认证提供者提供者进行身份验证。提供者必须是OAuthProvider 。非 OAuth 提供商(例如EmailAuthProvider)将引发错误。
解析器弹出重定向解析器PopupRedirectResolver的实例,如果已提供给initializeAuth()或由getAuth()提供,则为可选

返回:

承诺<用户凭证>

例子

// Sign in using some other provider.
const result = await signInWithEmailAndPassword(auth, email, password);
// Link using a popup.
const provider = new FacebookAuthProvider();
await linkWithPopup(result.user, provider);

linkWithRedirect(用户,提供者,解析器)

使用全页重定向流将OAuthProvider链接到用户帐户。

要处理此操作的结果和错误,请参考getRedirectResult() 。使用linkWithRedirect()时遵循最佳实践

此方法不适用于 Node.js 环境。

签名:

export declare function linkWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;

参数

范围类型描述
用户用户用户。
提供者认证提供者提供者进行身份验证。提供者必须是OAuthProvider 。非 OAuth 提供商(例如EmailAuthProvider)将引发错误。
解析器弹出重定向解析器PopupRedirectResolver的实例,如果已经提供给initializeauth()getauth()提供的可选

返回:

承诺<every>

例子

// Sign in using some other provider.
const result = await signInWithEmailAndPassword(auth, email, password);
// Link using a redirect.
const provider = new FacebookAuthProvider();
await linkWithRedirect(result.user, provider);
// This will trigger a full page redirect away from your app

// After returning from the redirect when your app initializes you can obtain the result
const result = await getRedirectResult(auth);

多因素(用户)

与用户相对应的多效应器

这用于访问与用户相关的所有多因素属性和操作。

签名:

export declare function multiFactor(user: User): MultiFactorUser;

参数

范围类型描述
用户用户用户。

返回:

多效应器

重新授权WithCredential(用户,凭据)

使用新的凭据重新认证用户。

在操作之前使用诸如UpdatePassword()之类的操作,该操作需要从最近的登录尝试中需要令牌。此方法可用于从CREDENTIAL_TOO_OLD_LOGIN_AGAIN错误或TOKEN_EXPIRED错误错误中恢复。

签名:

export declare function reauthenticateWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>;

参数

范围类型描述
用户用户用户。
凭据身份认证身份证书。

返回:

Promise < Usercredential >

重新授权WithphoneNumber(用户,Phonenumber,Apphverier)

使用新的电话凭据重新认证用户。

在操作之前使用诸如UpdatePassword()之类的操作,该操作需要从最近的登录尝试中需要令牌。

此方法在node.js环境中不起作用。

签名:

export declare function reauthenticateWithPhoneNumber(user: User, phoneNumber: string, appVerifier: ApplicationVerifier): Promise<ConfirmationResult>;

参数

范围类型描述
用户用户用户。
电话号码细绳用户的电话号码以e.164格式(例如+16505550101)。
相关器ApplicationVerifier应用程序服务器

返回:

Promise <确认重点>

重新授权WithPopup(用户,提供商,解析器)

使用基于弹出的OAuth流量,使用指定的OAuthProvider对当前用户进行重新验证。

如果重新验证成功,则返回的结果将包含用户和提供商的凭据。

此方法在node.js环境中不起作用。

签名:

export declare function reauthenticateWithPopup(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>;

参数

范围类型描述
用户用户用户。
提供者AuthProvider提供者可以进行身份​​验证。提供商必须是oauthproviderEmailAuthProvider (例如Emainauthprovider)的非欧洲诉讼提供商将出现错误。
解析器popupredirectResolver popupredirectResolver的实例,如果已经提供给initializeauth()getauth()提供的可选

返回:

Promise < Usercredential >

例子

// Sign in using a popup.
const provider = new FacebookAuthProvider();
const result = await signInWithPopup(auth, provider);
// Reauthenticate using a popup.
await reauthenticateWithPopup(result.user, provider);

重新授权WithRedirect(用户,提供商,解析器)

使用全页重定向流量通过指定的OAuthProvider对当前用户进行重新验证。

要处理此操作的结果和错误,请参阅GetRedirectResult() 。使用ReePulenticateWithRedirect()时遵循最佳实践

此方法在node.js环境中不起作用。

签名:

export declare function reauthenticateWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;

参数

范围类型描述
用户用户用户。
提供者AuthProvider提供者可以进行身份​​验证。提供商必须是oauthproviderEmailAuthProvider (例如Emainauthprovider)的非欧洲诉讼提供商将出现错误。
解析器popupredirectResolver popupredirectResolver的实例,如果已经提供给initializeauth()getauth()提供的可选

返回:

承诺<every>

例子

// Sign in using a redirect.
const provider = new FacebookAuthProvider();
const result = await signInWithRedirect(auth, provider);
// This will trigger a full page redirect away from your app

// After returning from the redirect when your app initializes you can obtain the result
const result = await getRedirectResult(auth);
// Reauthenticate using a redirect.
await reauthenticateWithRedirect(result.user, provider);
// This will again trigger a full page redirect away from your app

// After returning from the redirect when your app initializes you can obtain the result
const result = await getRedirectResult(auth);

重新加载(用户)

重新加载用户帐户数据(如果签名)。

签名:

export declare function reload(user: User): Promise<void>;

参数

范围类型描述
用户用户用户。

返回:

承诺<void>

sendemailverification(用户,动作库)

向用户发送验证电子邮件。

验证过程是通过调用applyactionCode()完成的

签名:

export declare function sendEmailVerification(user: User, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;

参数

范围类型描述
用户用户用户。
Action Codesettings ActionCodesettings |无效的动作尺寸

返回:

承诺<void>

例子

const actionCodeSettings = {
  url: 'https://www.example.com/?email=user@example.com',
  iOS: {
     bundleId: 'com.example.ios'
  },
  android: {
    packageName: 'com.example.android',
    installApp: true,
    minimumVersion: '12'
  },
  handleCodeInApp: true
};
await sendEmailVerification(user, actionCodeSettings);
// Obtain code from the user.
await applyActionCode(auth, code);

将提供商与用户帐户联系起来。

签名:

export declare function unlink(user: User, providerId: string): Promise<User>;

参数

范围类型描述
用户用户用户。
Providerid细绳提供商要取消链接。

返回:

承诺<用户>

UpdateEmail(用户,newemail)

更新用户的电子邮件地址。

一封电子邮件将发送到原始电子邮件地址(如果设置的话),该电子邮件允许撤销电子邮件地址更改,以保护它们免受帐户劫持。

签名:

export declare function updateEmail(user: User, newEmail: string): Promise<void>;

参数

范围类型描述
用户用户用户。
新邮件细绳新的电子邮件地址。当启用[https://cloud.google.com/indesity-platform/docs/admin/admin/email-email-enumeration-protection)时,抛出“ auth/auth/operation-not-howered”错误(https://cloud.google.com/indy.google.com/indy.google.com/side。弃用 - 改用verifybeforeupdateemail()

返回:

承诺<void>

UpdatePassword(用户,newPassword)

更新用户的密码。

签名:

export declare function updatePassword(user: User, newPassword: string): Promise<void>;

参数

范围类型描述
用户用户用户。
新密码细绳新密码。

返回:

承诺<void>

UpdatePhoneNumber(用户,凭据)

更新用户的电话号码。

此方法在node.js环境中不起作用。

签名:

export declare function updatePhoneNumber(user: User, credential: PhoneAuthCredential): Promise<void>;

参数

范围类型描述
用户用户用户。
凭据phoneAuthcredential凭证身份验证新电话号码。

返回:

承诺<void>

例子

// 'recaptcha-container' is the ID of an element in the DOM.
const applicationVerifier = new RecaptchaVerifier('recaptcha-container');
const provider = new PhoneAuthProvider(auth);
const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);
// Obtain the verificationCode from the user.
const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
await updatePhoneNumber(user, phoneCredential);

updateProfile(用户,{displayName,photourl:photourl})

更新用户的个人资料数据。

签名:

export declare function updateProfile(user: User, { displayName, photoURL: photoUrl }: {
    displayName?: string | null;
    photoURL?: string | null;
}): Promise<void>;

参数

范围类型描述
用户用户用户。
{displayName,photourl:photourl} {displayName?:字符串|无效的; photourl?:字符串|无效的; }

返回:

承诺<void>

verifybeforeupdateemail(用户,newemail,Action Codesettings)

将验证电子邮件发送到新的电子邮件地址。

经过验证后,用户的电子邮件将更新到新电子邮件。

如果您有自定义的电子邮件操作处理程序,则可以通过调用ApplionActionCode()来完成验证过程

签名:

export declare function verifyBeforeUpdateEmail(user: User, newEmail: string, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;

参数

范围类型描述
用户用户用户。
新邮件细绳更新之前要验证的新电子邮件地址。
Action Codesettings ActionCodesettings |无效的动作尺寸

返回:

承诺<void>

例子

const actionCodeSettings = {
  url: 'https://www.example.com/?email=user@example.com',
  iOS: {
     bundleId: 'com.example.ios'
  },
  android: {
    packageName: 'com.example.android',
    installApp: true,
    minimumVersion: '12'
  },
  handleCodeInApp: true
};
await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings);
// Obtain code from the user.
await applyActionCode(auth, code);

功能(用户限制,...)

getAdditionaluserInfo(用户credential)

提取给定凭证的提供商特定的额外用品

签名:

export declare function getAdditionalUserInfo(userCredential: UserCredential): AdditionalUserInfo | null;

参数

范围类型描述
用户行为用户行为用户凭据。

返回:

其他userinfo |无效的

ActionCodoperation

列举可能的电子邮件操作类型。

签名:

ActionCodeOperation: {
    readonly EMAIL_SIGNIN: "EMAIL_SIGNIN";
    readonly PASSWORD_RESET: "PASSWORD_RESET";
    readonly RECOVER_EMAIL: "RECOVER_EMAIL";
    readonly REVERT_SECOND_FACTOR_ADDITION: "REVERT_SECOND_FACTOR_ADDITION";
    readonly VERIFY_AND_CHANGE_EMAIL: "VERIFY_AND_CHANGE_EMAIL";
    readonly VERIFY_EMAIL: "VERIFY_EMAIL";
}

自我代码

潜在的Auth错误代码的地图,以便于与SDK丢弃的错误进行更轻松的比较。

请注意,您无法在地图中的树蛋糕中的单个钥匙,因此,通过使用地图,您可能会大大增加捆绑包大小。

签名:

AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY: {
    readonly ADMIN_ONLY_OPERATION: "auth/admin-restricted-operation";
    readonly ARGUMENT_ERROR: "auth/argument-error";
    readonly APP_NOT_AUTHORIZED: "auth/app-not-authorized";
    readonly APP_NOT_INSTALLED: "auth/app-not-installed";
    readonly CAPTCHA_CHECK_FAILED: "auth/captcha-check-failed";
    readonly CODE_EXPIRED: "auth/code-expired";
    readonly CORDOVA_NOT_READY: "auth/cordova-not-ready";
    readonly CORS_UNSUPPORTED: "auth/cors-unsupported";
    readonly CREDENTIAL_ALREADY_IN_USE: "auth/credential-already-in-use";
    readonly CREDENTIAL_MISMATCH: "auth/custom-token-mismatch";
    readonly CREDENTIAL_TOO_OLD_LOGIN_AGAIN: "auth/requires-recent-login";
    readonly DEPENDENT_SDK_INIT_BEFORE_AUTH: "auth/dependent-sdk-initialized-before-auth";
    readonly DYNAMIC_LINK_NOT_ACTIVATED: "auth/dynamic-link-not-activated";
    readonly EMAIL_CHANGE_NEEDS_VERIFICATION: "auth/email-change-needs-verification";
    readonly EMAIL_EXISTS: "auth/email-already-in-use";
    readonly EMULATOR_CONFIG_FAILED: "auth/emulator-config-failed";
    readonly EXPIRED_OOB_CODE: "auth/expired-action-code";
    readonly EXPIRED_POPUP_REQUEST: "auth/cancelled-popup-request";
    readonly INTERNAL_ERROR: "auth/internal-error";
    readonly INVALID_API_KEY: "auth/invalid-api-key";
    readonly INVALID_APP_CREDENTIAL: "auth/invalid-app-credential";
    readonly INVALID_APP_ID: "auth/invalid-app-id";
    readonly INVALID_AUTH: "auth/invalid-user-token";
    readonly INVALID_AUTH_EVENT: "auth/invalid-auth-event";
    readonly INVALID_CERT_HASH: "auth/invalid-cert-hash";
    readonly INVALID_CODE: "auth/invalid-verification-code";
    readonly INVALID_CONTINUE_URI: "auth/invalid-continue-uri";
    readonly INVALID_CORDOVA_CONFIGURATION: "auth/invalid-cordova-configuration";
    readonly INVALID_CUSTOM_TOKEN: "auth/invalid-custom-token";
    readonly INVALID_DYNAMIC_LINK_DOMAIN: "auth/invalid-dynamic-link-domain";
    readonly INVALID_EMAIL: "auth/invalid-email";
    readonly INVALID_EMULATOR_SCHEME: "auth/invalid-emulator-scheme";
    readonly INVALID_IDP_RESPONSE: "auth/invalid-credential";
    readonly INVALID_LOGIN_CREDENTIALS: "auth/invalid-credential";
    readonly INVALID_MESSAGE_PAYLOAD: "auth/invalid-message-payload";
    readonly INVALID_MFA_SESSION: "auth/invalid-multi-factor-session";
    readonly INVALID_OAUTH_CLIENT_ID: "auth/invalid-oauth-client-id";
    readonly INVALID_OAUTH_PROVIDER: "auth/invalid-oauth-provider";
    readonly INVALID_OOB_CODE: "auth/invalid-action-code";
    readonly INVALID_ORIGIN: "auth/unauthorized-domain";
    readonly INVALID_PASSWORD: "auth/wrong-password";
    readonly INVALID_PERSISTENCE: "auth/invalid-persistence-type";
    readonly INVALID_PHONE_NUMBER: "auth/invalid-phone-number";
    readonly INVALID_PROVIDER_ID: "auth/invalid-provider-id";
    readonly INVALID_RECIPIENT_EMAIL: "auth/invalid-recipient-email";
    readonly INVALID_SENDER: "auth/invalid-sender";
    readonly INVALID_SESSION_INFO: "auth/invalid-verification-id";
    readonly INVALID_TENANT_ID: "auth/invalid-tenant-id";
    readonly MFA_INFO_NOT_FOUND: "auth/multi-factor-info-not-found";
    readonly MFA_REQUIRED: "auth/multi-factor-auth-required";
    readonly MISSING_ANDROID_PACKAGE_NAME: "auth/missing-android-pkg-name";
    readonly MISSING_APP_CREDENTIAL: "auth/missing-app-credential";
    readonly MISSING_AUTH_DOMAIN: "auth/auth-domain-config-required";
    readonly MISSING_CODE: "auth/missing-verification-code";
    readonly MISSING_CONTINUE_URI: "auth/missing-continue-uri";
    readonly MISSING_IFRAME_START: "auth/missing-iframe-start";
    readonly MISSING_IOS_BUNDLE_ID: "auth/missing-ios-bundle-id";
    readonly MISSING_OR_INVALID_NONCE: "auth/missing-or-invalid-nonce";
    readonly MISSING_MFA_INFO: "auth/missing-multi-factor-info";
    readonly MISSING_MFA_SESSION: "auth/missing-multi-factor-session";
    readonly MISSING_PHONE_NUMBER: "auth/missing-phone-number";
    readonly MISSING_SESSION_INFO: "auth/missing-verification-id";
    readonly MODULE_DESTROYED: "auth/app-deleted";
    readonly NEED_CONFIRMATION: "auth/account-exists-with-different-credential";
    readonly NETWORK_REQUEST_FAILED: "auth/network-request-failed";
    readonly NULL_USER: "auth/null-user";
    readonly NO_AUTH_EVENT: "auth/no-auth-event";
    readonly NO_SUCH_PROVIDER: "auth/no-such-provider";
    readonly OPERATION_NOT_ALLOWED: "auth/operation-not-allowed";
    readonly OPERATION_NOT_SUPPORTED: "auth/operation-not-supported-in-this-environment";
    readonly POPUP_BLOCKED: "auth/popup-blocked";
    readonly POPUP_CLOSED_BY_USER: "auth/popup-closed-by-user";
    readonly PROVIDER_ALREADY_LINKED: "auth/provider-already-linked";
    readonly QUOTA_EXCEEDED: "auth/quota-exceeded";
    readonly REDIRECT_CANCELLED_BY_USER: "auth/redirect-cancelled-by-user";
    readonly REDIRECT_OPERATION_PENDING: "auth/redirect-operation-pending";
    readonly REJECTED_CREDENTIAL: "auth/rejected-credential";
    readonly SECOND_FACTOR_ALREADY_ENROLLED: "auth/second-factor-already-in-use";
    readonly SECOND_FACTOR_LIMIT_EXCEEDED: "auth/maximum-second-factor-count-exceeded";
    readonly TENANT_ID_MISMATCH: "auth/tenant-id-mismatch";
    readonly TIMEOUT: "auth/timeout";
    readonly TOKEN_EXPIRED: "auth/user-token-expired";
    readonly TOO_MANY_ATTEMPTS_TRY_LATER: "auth/too-many-requests";
    readonly UNAUTHORIZED_DOMAIN: "auth/unauthorized-continue-uri";
    readonly UNSUPPORTED_FIRST_FACTOR: "auth/unsupported-first-factor";
    readonly UNSUPPORTED_PERSISTENCE: "auth/unsupported-persistence-type";
    readonly UNSUPPORTED_TENANT_OPERATION: "auth/unsupported-tenant-operation";
    readonly UNVERIFIED_EMAIL: "auth/unverified-email";
    readonly USER_CANCELLED: "auth/user-cancelled";
    readonly USER_DELETED: "auth/user-not-found";
    readonly USER_DISABLED: "auth/user-disabled";
    readonly USER_MISMATCH: "auth/user-mismatch";
    readonly USER_SIGNED_OUT: "auth/user-signed-out";
    readonly WEAK_PASSWORD: "auth/weak-password";
    readonly WEB_STORAGE_UNSUPPORTED: "auth/web-storage-unsupported";
    readonly ALREADY_INITIALIZED: "auth/already-initialized";
    readonly RECAPTCHA_NOT_ENABLED: "auth/recaptcha-not-enabled";
    readonly MISSING_RECAPTCHA_TOKEN: "auth/missing-recaptcha-token";
    readonly INVALID_RECAPTCHA_TOKEN: "auth/invalid-recaptcha-token";
    readonly INVALID_RECAPTCHA_ACTION: "auth/invalid-recaptcha-action";
    readonly MISSING_CLIENT_TYPE: "auth/missing-client-type";
    readonly MISSING_RECAPTCHA_VERSION: "auth/missing-recaptcha-version";
    readonly INVALID_RECAPTCHA_VERSION: "auth/invalid-recaptcha-version";
    readonly INVALID_REQ_TYPE: "auth/invalid-req-type";
}

browserlocalististence

使用localStorage用于基础存储的LOCAL类型的持久性实现。

签名:

browserLocalPersistence: Persistence

browserPopupRedirectResolver

适用于基于浏览器的应用程序的PopupRedectResolver的实现。

此方法在node.js环境中不起作用。

签名:

browserPopupRedirectResolver: PopupRedirectResolver

浏览经验

使用sessionStorage进行基础存储的SESSION持续性的实现。

签名:

browserSessionPersistence: Persistence

CordovaPopupRedirectResolver

适用于基于Cordova的应用程序的PopupredectResolver的实现。

签名:

cordovaPopupRedirectResolver: PopupRedirectResolver

debugerrormap

大多数错误代码的详细描述的详细错误映射。

请参阅AutherRormap的讨论

签名:

debugErrorMap: AuthErrorMap

fixsid

可以用于多因素身份验证的一系列因素。

签名:

FactorId: {
    readonly PHONE: "phone";
    readonly TOTP: "totp";
}

索引dblocalcalistensive

使用indexedDB进行基础存储的LOCAL类型持久性的实现。

签名:

indexedDBLocalPersistence: Persistence

不良过性

“无”类型持久性的实现。

签名:

inMemoryPersistence: Persistence

操作类型

支持操作类型的枚举。

签名:

OperationType: {
    readonly LINK: "link";
    readonly REAUTHENTICATE: "reauthenticate";
    readonly SIGN_IN: "signIn";
}

proderrormap

最小错误映射,所有详细错误消息都删除了。

请参阅AutherRormap的讨论

签名:

prodErrorMap: AuthErrorMap

Providerid

枚举支持提供者。

签名:

ProviderId: {
    readonly FACEBOOK: "facebook.com";
    readonly GITHUB: "github.com";
    readonly GOOGLE: "google.com";
    readonly PASSWORD: "password";
    readonly PHONE: "phone";
    readonly TWITTER: "twitter.com";
}

SignInMethod

支持的登录方法的枚举。

签名:

SignInMethod: {
    readonly EMAIL_LINK: "emailLink";
    readonly EMAIL_PASSWORD: "password";
    readonly FACEBOOK: "facebook.com";
    readonly GITHUB: "github.com";
    readonly GOOGLE: "google.com";
    readonly PHONE: "phone";
    readonly TWITTER: "twitter.com";
}

定制参数

OAUTH自定义参数的地图。

签名:

export declare type CustomParameters = Record<string, string>;

NextRobserver

键入事件回调的定义。

签名:

export declare type NextOrObserver<T> = NextFn<T | null> | Observer<T | null>;

phoneinfooptions

验证电话号码所有权所需的信息。

所需的信息取决于您是进行单因素登录,多因素注册还是多因素登录。

签名:

export declare type PhoneInfoOptions = PhoneSingleFactorInfoOptions | PhoneMultiFactorEnrollInfoOptions | PhoneMultiFactorSignInInfoOptions;

用户资料

用户配置文件中使用的用户配置文件

签名:

export declare type UserProfile = Record<string, unknown>;