Skip to content

tomasznajda/rx-recaptcha

Repository files navigation

rx-recaptcha

Download Android Arsenal CircleCI
An easy way to use SafetyNet reCAPTCHA with RxJava2

Usage

1. Register a reCAPTCHA key pair

To register a key pair for use with the SafetyNet reCAPTCHA API, navigate to the reCAPTCHA Android signup site

2. Add dependency

dependencies {
    implementation "com.tomasznajda.rxrecaptcha:rxrecaptcha:16.0.0.2"
}

3. Use reCAPTCHA verification inside your Android app

ReCaptcha()
        .verify(context = this, siteKey = YOUR_SITE_KEY)
        .subscribeBy(
                onSuccess = { printToken(token = it) },
                onError = { printError(error = it) })

4. Validate reCAPTCHA response token

To learn how to validate the user's response token, see Verifying the user's response

Usage of sample

  1. Register a reCAPTCHA key pair: reCAPTCHA Android signup site
  2. Put your "Site key" inside MainActivity#YOUR_SITE_KEY constant
  3. Compile & run the app

Useful links