B4J Question [Server] How to use recaptcha with websocket ?

Omar Moreno

Member
Licensed User
Longtime User
Hello everyone.

I followed the instructions in this link: reCAPTCHA V.2
I was able to get the keys and display the recaptcha object



But when the HTTJOB is executed the response is an error:
error-codes: [invalid-input-response]
success: false

I suspect that my error is in this line:
sb.Append("&response=").Append(ws.UpgradeRequest.GetParameter("g-recaptcha-response"))

B4X:
Dim sb As StringBuilder
sb.Initialize
sb.Append("secret=").Append(Main.settings.Get("RecaptchaPrivateKey"))
sb.Append("&response=").Append(ws.UpgradeRequest.GetParameter("g-recaptcha-response")) '<------
j.PostString("https://www.google.com/recaptcha/api/siteverify", sb.ToString)

How should I get the parameter: g-recaptcha-response using websocket?

Thanks for your possible answers.
 

MicroDrie

Well-Known Member
Licensed User
j.PostString("https://www.google.com/recaptcha/api/siteverify", sb.ToString)
The s in https stands for secure, the WebSocket (WS) protocol missed the S from WSS(WebSocket Secure). The result of the un-encrypted WebSocket protocol is that the protocol information can be read by everyone or simple said: every one can steal the information. That's the reason why WebSocket is not used without additional measures.
 
Upvote 0

Omar Moreno

Member
Licensed User
Longtime User
Hi MicroDrie.
What you mean is that websocket does not require the use of recaptcha, and that a form with websocket cannot be attacked by a robot with false data and even bring down the server.
I don't need recaptcha with websocket?
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
What I mean is that you want find an implementation of re-captcha on the web socket protocol, re-captcha needs a successful secure connection.
 
Upvote 0

Omar Moreno

Member
Licensed User
Longtime User
What I mean is that you want find an implementation of re-captcha on the web socket protocol, re-captcha needs a successful secure connection.
Hi
I programmed the use of recaptcha/WebSocket on the production server that uses SSL and it still gives me:
error-codes: [invalid-input-response]
success: false

Could you provide me with an example of Recaptcha with WebSocket
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…