As per the hcaptcha docs it says:
I have done this, but I still get a CORS error in my requests. I am visiting the URL from:
http://test.mydomain.com:3000
and in my network requests it comes from the same URL.
My hosts file contains:
127.0.0.1 test.mydomain.com
I'm not sure what else to try.
const handleVerificationSuccess = async (token, ekey) => {
console.log(token);
// Provide your secret key here
const secretKey = '...';
const response = await fetch('https://hcaptcha.com/siteverify', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `response=${token}&secret=${secretKey}`, // make sure to URL encode the data
});
const data = await response.json();
};