'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 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rogue Ram