I'm trying to verify a Google reCAPTCHA
response in my local environment Java(SpringBoot) code. I keep getting this exception no matter what method I try to use to make a REST call. But I'm able to get a response from Google when I hit the same API from both PostMan and also when I deploy the code on our Azure plateform.
Is there some way to work around this?
Below is the URL:
https://www.google.com/recaptcha/api/siteverify?secret=<secrete_key>&response=<gRecaptchaResponse>
Below is the exception that is being thrown:
for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://www.google.com/recaptcha/api/siteverify": Connection reset; nested exception is java.net.SocketException: Connection reset] with root cause
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:210) ~[na:1.8.0_161]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_161]
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) ~[na:1.8.0_161]
at sun.security.ssl.InputRecord.read(InputRecord.java:503) ~[na:1.8.0_161]
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983) ~[na:1.8.0_161]
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385) ~[na:1.8.0_161]
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413) ~[na:1.8.0_161]