hCaptcha Indicate whether to send a cookie in a cross-site request by specifying its SameSite attribute

328 Views Asked by At

I'm trying to implement hCaptcha in my codeigniter 3 website however whenever I submit the form an error pops up which is "Indicate whether to send a cookie in a cross-site request by specifying its SameSite attribute".

public function appointment()
    {

        if (isset($_POST['submit'])) {
            $data = array(
                'secret' => "MYSECRETKEY",
                'response' => $_POST['h-captcha-response']
            );
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, "https://hcaptcha.com/siteverify");
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $response = curl_exec($ch);
            $responseData = json_decode($response);
            if ($responseData->success) {
                $this->Appointment_model->create();
            } else {
                echo 'Robot verification failed, please try again.';
            }
        }
    }

I tried setting the header to SameSite=None, Secured but it did not work. How to I solve this problem?

0

There are 0 best solutions below