Using google reCAPTCHA v2 through a proxy with java


Hello Friends,

Today I bring you a tutorial to configure Google recaptcha V2 on your site.


Google recaptcha is a tool that protects your forms against malicious robots that try to overturn your application or even uncover sensitive information.

In this tutorial we will teach how to configure a JSP page that will submit the captcha to a java class, this class will validate if the captcha is valid and return to the JSP, if it is valid the JSP will redirect to a specific page.

Let’s go step by step:

1) Sign in to and sign up for your application.

You will enter your domain and they will provide you with a public key and a private key.

2) Set up your form and your credentials.

3) Creating the Java class that receives the captcha, make the validation and returns to its jsp.

Remembering that the JSONObject class instantiated below is from the Opencms library, you can use your preferred library to read the return of the request that is a JSON file.

So that’s it folks!

Any questions or suggestions leave your comment below!

Hugs and see you soon!