指南
Firebase 身份验证教程
使用@capgo/capacitor-firebase-authentication
Capacitor插件用于Firebase 身份验证
安装
bun add @capgo/capacitor-firebase-authentication
bunx cap sync
此插件暴露的内容
applyActionCode- 验证通过邮件发送给用户的codeconfirmPasswordReset- 完成密码重置流程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 (企业) 中的实现细节。