drf-recaptcha icon indicating copy to clipboard operation
drf-recaptcha copied to clipboard

Support for reCAPTCHA Enterprise

Open mixxorz opened this issue 4 years ago • 4 comments

At the moment, the library only supports reCAPTCHA v2 and v3. It would be great if this library also supported reCAPTCHA Enterprise.

mixxorz avatar Aug 13 '21 12:08 mixxorz

Attach the manual please, PR welcome also ;)

llybin avatar Aug 13 '21 12:08 llybin

Here is the the REST API documentation

I need this for a project I'm working on now. I will try and see if I can build this in a way that can be backported to drf-recaptcha then open a PR. 😄

mixxorz avatar Aug 13 '21 12:08 mixxorz

It's looking like I will need to use Google's official client library python-recaptcha-enterprise which is a completely different way of interacting with the Google Cloud APIs from what's currently in drf-recaptcha.

The annoying thing about it (aside from requiring another library) is that it requires a Google service account to use. The credentials used for service accounts are in JSON format. It's not just an API key.

It also communicates via an RPC and not through a JSON API.

mixxorz avatar Aug 13 '21 13:08 mixxorz

They are have REST also, https://cloud.google.com/recaptcha-enterprise/docs/reference/rest Choose the simpliest way for your project ;) I'm not sure that we need additional depends in drf-recaptcha, but it's also possibe, if using their library will much better instead REST. But I'm not sure :) Just create new Field class here https://github.com/llybin/drf-recaptcha/blob/master/drf_recaptcha/fields.py#L62 and write validator using their library I think it's will quicklier for u. And can to add tests, next we can rewrite it on using rest api for example. If to use REST I think will need to write similar client https://github.com/llybin/drf-recaptcha/blob/master/drf_recaptcha/client.py because interfaces are diffrent. Yes look like usage not similar with not enterprise captcha, so will need to create a special credentionals settings for enterpise.

llybin avatar Aug 13 '21 16:08 llybin