An easy way to use SafetyNet reCAPTCHA with RxJava2
To register a key pair for use with the SafetyNet reCAPTCHA API, navigate to the reCAPTCHA Android signup site
dependencies {
implementation "com.tomasznajda.rxrecaptcha:rxrecaptcha:16.0.0.2"
}
ReCaptcha()
.verify(context = this, siteKey = YOUR_SITE_KEY)
.subscribeBy(
onSuccess = { printToken(token = it) },
onError = { printError(error = it) })
To learn how to validate the user's response token, see Verifying the user's response
- Register a reCAPTCHA key pair: reCAPTCHA Android signup site
- Put your "Site key" inside MainActivity#YOUR_SITE_KEY constant
- Compile & run the app