Adding Google recaptcha to Java Swing


New member
I'm doing a swing client to connect on a site, but it have a recaptcha. So I'd like to grab this recaptcha and put on my application, maybe on a webview, so the user can make it.

To manage that, I make a GET request to the site where the captcha are and get the data-sitekey, send this key to my server and generate a simple htlm, which is sent back to the client to show the captcha on the webview.

Here is the simple htlm which is sent to the client:
<script src=""></script>
<script src=''></script>
       <form action="hello" method="POST">
             <div class="g-recaptcha"
    var onSuccess = function(response) {
    function clickCaptcha() {

Thesting it with Googles's recaptcha demo page ( it was working just fine, but when I got the target syte data-key, it gives an error: "invalid domain for the site key"

Just wondering how does 2captcha service, for example, can get the captcha and send to other person to solve it?

EDIT: When you create your data-sitekey to use recaptcha on your site, you should tell in which domain it will work. I tryed to fake the domain by modifying requet's headers (Host, Referer and Origin), but didn't work as well.