搜索插件、代码仓与 APP 分类

插件详情v0.1.0

flutter_recaptcha_v2

一个用于 Google ReCaptcha V2 的 Flutter 插件。

近 30 天下载
68
喜欢数
39
Pub 分数
15

安装插件

flutter pub add flutter_recaptcha_v2

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个将 Google ReCaptcha V2 集成到移动应用程序中的 Flutter 插件,使开发者能够为表单和登录流程添加机器人保护。它提供了一个简单的界面,在 Android 和 iOS 平台上渲染和验证 reCAPTCHA 挑战。该插件处理与 Google reCAPTCHA 服务的底层通信,确保用户交互的安全验证。设计简洁易用,支持异步验证,并返回令牌以供服务器端验证。

适合场景

  • 保护登录表单免受机器人攻击
  • 保护联系表单提交
  • 防止自动账户创建
  • 增强注册工作流中的安全性
  • 验证敏感操作中的用户行为

主要特点

  • 与 Flutter 应用的简单集成
  • 支持 reCAPTCHA V2 隐式和常规类型
  • 返回验证令牌以供服务器验证
  • 跨平台兼容性(Android 和 iOS)
  • 异步验证工作流

适合对象

  • 开发安全的身份验证流程的开发者
  • 需要在表单上进行机器人保护的应用程序
  • 需要遵守反滥用措施的项目
  • 将 Google 的 reCAPTCHA 服务集成到 Flutter 中的 Teams
  • 移动应用存在高度自动滥用风险

使用建议

  • 需要互联网连接以进行 reCAPTCHA 验证
  • 服务器端令牌验证是强制性的
  • 如果实施不当,可能会影响用户体验
  • 依赖外部谷歌服务的可用性
  • 仅限 reCAPTCHA V2,不包括 V3 或更新版本

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

flutter_recaptcha_v2

A Flutter plugin for Google ReCaptcha V2.

Getting Started

This plugin requires Webview to use Google ReCaptcha. This plugin only supports Google ReCAPTCHA V2 (not V3)

Obtain your own key & secret here: https://www.google.com/recaptcha

!!! Remember to add this domain into the reCaptcha setting or add your own domain: recaptcha-flutter-plugin.firebaseapp.com

Then test your API KEY at: https://recaptcha-flutter-plugin.firebaseapp.com/?api_key=API_KEY

Put RecaptchaV2 widget into your widget tree (Usually inside Stack widget), make sure it's placed on top of the tree and block all the behind interactions:

  • You can change the plugin url for the captcha domain insde the RecaptchaV2 or leave it by default non adding the line:
pluginURL: "https://mypersonalurl.com"

if you have setted your own domain, specify the domain used

  • To show the Cancel Button with the captcha controller set the boolean to true:
visibleCancelBottom: true

otherwise it won't appear

  • Set the Text for the Cancel buttom or leave it by default:
textCancelButtom: "CANCEL CAPTCHA"
Example
RecaptchaV2Controller recaptchaV2Controller = RecaptchaV2Controller();
...
RecaptchaV2(
    apiKey: "YOUR_API_KEY", // for enabling the reCaptcha
    apiSecret: "YOUR_API_SECRET", // for verifying the responded token
    pluginURL: "https://mypersonalurl.com",
	visibleCancelBottom: true,
	textCancelButtom: "CUSTOM CANCEL CAPTCHA BUTTOM TEXT",
	controller: recaptchaV2Controller,
    onVerifiedError: (err){
        print(err);
    },
    onVerifiedSuccessfully: (success) {
        setState(() {
            if (success) {
                // You've been verified successfully.
            } else {
                // "Failed to verify.
            }
        });
    },
),

The RecaptchaV2 widget is hidden by default, you need to attach the RecaptchaV2Controller and call show() method when needed. Like this:

recaptchaV2Controller.show();

Manually hide it:

recaptchaV2Controller.hide();

That's it!

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。