Error while hitting freshdesk api: SSL certificate verification failed

Hi,
We are not able to hit freshdesk contacts api from our web application. However, we are able to hit it successfully while testing our app. But when we are submitting the application to be published to the marketplace, while testing, it gives the following response:
“{“code”:“ssl_required”,“message”:“SSL certificate verification failed.”}”

We are using the freshdesk api in the following format:
PHP CODE:
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $freshdesk_domain . “/api/v2/contacts?phone=” . $mobile_number,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_TIMEOUT => 30,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => “GET”,
CURLOPT_HTTPHEADER => [
“Content-Type: application/json”,
"Authorization: Basic " . $freshdesk_api_token
],
]);

        $response = curl_exec($curl);

Please advice to proceed.

1 Like

Hi,

Are you using HTTPS in $freshdesk_domain value?
Also, why are you setting CURLOPT_SSL_VERIFYHOST as 0, Ideally in the production environment you should set this value as 2. You can keep using default values for both these options CURLOPT_SSL_VERIFYPEER, CURLOPT_SSL_VERIFYHOST.
SSL certificate verification failed is generally occurs when you are trying to pass non-https URL on a HTTPS API.

Try to validate checking with HTTPS endpoint and removing the above two options and update here did it solved your issues are not.

6 Likes

Thanks, the issue got solved by following the mentioned steps.

2 Likes