指南
Firebase 认证教程
使用 @capgo/capacitor-firebase-authentication
Capacitor 对 Firebase 认证的插件
安装
bun add @capgo/capacitor-firebase-authentication
bunx cap sync
此插件暴露了什么
applyActionCode- 使用用户通过电子邮件接收的验证 code 进行验证。confirmPasswordReset- 完成密码重置流程。confirmVerificationCode- 完成电话号码验证流程。createUserWithEmailAndPassword- 使用电子邮件和密码创建新用户帐户。如果新帐户创建成功,用户会自动登录。
- 示例用法
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);
- 全部参考
- - GitHub: - https://github.com/Cap-go/capacitor-firebase/tree/main/packages/authentication
- 文档:/docs/plugins/firebase-authentication/
继续使用@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 (企业)的实现细节