Fix Limble auth and secure request handling

This commit is contained in:
Jeppe B
2026-06-01 22:50:00 +02:00
parent 4945abfd8e
commit 324f2c856f
2 changed files with 7 additions and 12 deletions
@@ -29,8 +29,8 @@ class limble_request implements limble_request_i
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// Set options to return the response and handle SSL
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
// Execute the request
$response = curl_exec($ch);
// Check for errors
@@ -44,11 +44,7 @@ class limble_request implements limble_request_i
// Check if the response is successful
if ($httpCode < 200 || $httpCode >= 300) {
$slack = new \classes\slack();
echo 'Attempting credentials: ' . $url . ' with method: ' . $method . ' and data: ' . json_encode($data) . "\n";
echo 'Response: ' . $response . "\n";
echo 'HTTP Code: ' . $httpCode . "\n";
echo 'Headers: ' . json_encode($headers) . "\n";
$slack->send_message('Limble Request Failed: ' . $response, 'Limble Request Error');
$slack->send_message('Limble Request Failed with status code: ' . $httpCode, 'Limble Request Error');
throw new \Exception('Request failed with status code ' . $httpCode);
}
// Check if the response is valid JSON
@@ -68,4 +64,4 @@ class limble_request implements limble_request_i
// Generate the Basic Auth header using the client ID and secret
return 'Authorization: Basic ' . base64_encode($client_id . ':' . $client_secret);
}
}
}