You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

集成RecaptchaVerifier遇必填参数auth缺失错误,请求技术帮助

解决RecaptchaVerifier必填参数‘auth’缺失问题

你当前的RecaptchaVerifier实例化代码缺少必填的auth命名参数,Firebase的RecaptchaVerifier必须关联FirebaseAuth实例才能正常运行。

修改后的完整代码如下:

RecaptchaVerifier(
  auth: FirebaseAuth.instance, // 新增必填的auth参数
  size: RecaptchaVerifierSize.compact,
  theme: RecaptchaVerifierTheme.dark,
  onSuccess: (){
    print('reCAPTCHA Completed!');
    if(!resend){
      nextPosition();
    }
    setState(() {
      _showResend = false;
    });
  },
  onError: (FirebaseAuthException error){
    QuickHelp.showAppNotificationAdvanced(
        context: context,
        title: "error".tr(),
        message: error.message);
  },
  onExpired: () {
    QuickHelp.showAppNotificationAdvanced(
        context: context,
        title: "error".tr(),
        message: "auth.recaptcha_expired".tr());
  },
)

关键说明:

  • auth: FirebaseAuth.instance是必填项,用于将Recaptcha验证与你的Firebase Auth服务绑定
  • 确保项目已正确配置Firebase Auth:在pubspec.yaml中添加firebase_auth依赖,且已完成Firebase初始化流程

内容的提问来源于stack exchange,提问作者dgenx

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.18 03:50:25