跳过主要内容

指南

Firebase 认证教程

使用 @capgo/capacitor-firebase-authentication

Capacitor 的 Firebase 认证插件

安装

bun add @capgo/capacitor-firebase-authentication
bunx cap sync

本插件暴露了什么内容

  • applyActionCode - 使用邮箱发送给用户的验证 code 。
  • confirmPasswordReset - 完成密码重置过程。
  • confirmVerificationCode - 完成手机验证过程。
  • createUserWithEmailAndPassword - 使用邮箱和密码创建新用户帐户。如果新帐户创建成功,用户会自动登录。

Example Usage

applyActionCode

使用邮箱发送给用户的验证 code 。

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';

await FirebaseAuthentication.applyActionCode({} as ApplyActionCodeOptions);

confirmPasswordReset

完成密码重置过程。

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';

await FirebaseAuthentication.confirmPasswordReset({} as ConfirmPasswordResetOptions);

confirmVerificationCode

完成手机验证过程。

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';

await FirebaseAuthentication.confirmVerificationCode({} as ConfirmVerificationCodeOptions);

createUserWithEmailAndPassword

使用邮箱和密码创建新用户帐户。如果新帐户创建成功,用户会自动登录。

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';

await FirebaseAuthentication.createUserWithEmailAndPassword({} as CreateUserWithEmailAndPasswordOptions);

Full Reference

从使用@capgo/capacitor-firebase-authentication

如果您正在使用 使用@capgo/capacitor-firebase-authentication 来规划身份验证和帐户流程,连接它与 @capgo/capacitor-social-login 在@capgo/capacitor-social-login中了解实现细节, @capgo/capacitor-passkey 在@capgo/capacitor-passkey中了解实现细节, @capgo/capacitor-native-biometric 在@capgo/capacitor-native-biometric中了解实现细节, 两因素身份验证 关于两步验证的实现细节 企业级SSO (单点登录) 关于企业级SSO (单点登录)的实现细节