Skip to main content

I am attempting to set up reCAPTCHA Enterprise on my Android app. I currently have the legacy reCAPTCHA system via the SafetyNet API, but Google is retiring that and so I need to transition over to the Play Integrity API with reCAPTCHA Enterprise. I have the API set up in Google Cloud, and I have created 2 different Android keys for testing purposes, one with my package name specified and one with package verification disabled. I followed Google's Android project setup documentation, but neither key will allow me to get the reCAPTCHA client. This is from my main activity:

 

 

 

lifecycleScope.launch {
Recaptcha.getClient(application, "my key here")
.onSuccess {
recaptchaClient = it
}
.onFailure { exception ->
println(exception)
}
}

 

 

 

This results in the following exception:

com.google.android.recaptcha.RecaptchaException: Key type invalid

I have checked the documentation, and this error is returned when:

Cannot create a reCAPTCHA client with a non-Android site key.
Please register new site key with the key type set to "Android app" via Create key.

Both of the keys I have attempted are Android app keys, shown here in the Google Cloud -> Security -> reCAPTCHA Enterprise page.

I am at a loss for what else to try. This appear to be the right keys, for the right platform, with the right service that is enabled. Anyone know what step I might be missing or how else to resolve this issue?

Hi @redeappdevelop ,

How are you doing?

It appears that you are using the reCAPTCHA process for integration with a website. I have attached the documentation here for itegrating reCAPTCHA for Android apps. 

I hope this helps. Good luck 


Hi @redeappdevelop ,

How are you doing?

It appears that you are using the reCAPTCHA process for integration with a website. I have attached the documentation here for itegrating reCAPTCHA for Android apps. 

I hope this helps. Good luck 


Which part of my setup appears to be the integration process for a website as opposed to Android? This is the same link that I have in my original question, and the code in the question is nearly a copy-paste from that link. 


Hi! i'm getting the same issue.
The code i'm using is from here:
https://github.com/GoogleCloudPlatform/recaptcha-enterprise-react-native/tree/main
That is where you get reading the same documentation you mentioned @LarryNic .

So, what is the problem? because the documentation says that i shouls use that library to implement recaptcha in a react native app (mobile)
Thanks in advance.


Hi all! If you are using our Mobile App SDKs, you should create an iOS or Android key type. Otherwise, you should use a website key type. For React, I believe you need to use a website key type.


Reply