javascriptnode.jsaxioshcaptcha

H-Captcha can't verify captcha key/token


Here is my code:

let result = await axios({
            method: 'post',
            url: 'https://hcaptcha.com/siteverify',
            params: {
                secret: "secret would be here",
                response: req.body.hcap
            }
        });
        let data = result.data || {};
        console.log(result)
        if(!data.success){
            res.send("bad token")
            return
        }
        else{
            res.send("good token") 
        }

I know that the token sent to the server is good.

Here is the error I'm receiving:

'error-codes': [ 'missing-input-response', 'missing-input-secret' ]

Solution

  • I ended up finding the solution to be installing the hcaptcha package which made this a lot simpler.