Try multiple authorization header formats for OMG API

Sending both X-API-Key and Authorization headers to see which one works.
Added header logging to troubleshoot auth issue.

The API is responding with 401 'Authorization field missing', so we need to
find the correct header format.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
DJP 2025-11-18 09:11:00 -05:00
parent 6c8c8ea508
commit 2db69b7f28

View file

@ -34,13 +34,20 @@ class OMGService {
error_log('OMG API: Requesting project ' . $projectNumber);
$ch = curl_init($url);
// Try different header formats - log what we're sending
$headers = [
'Content-Type: application/json',
'X-API-Key: ' . $this->apiKey,
'Authorization: ' . $this->apiKey
];
error_log('OMG API: Sending headers: ' . json_encode($headers));
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => $this->timeout,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: ' . $this->apiKey // Send API key directly (not "Bearer")
]
CURLOPT_HTTPHEADER => $headers
]);
$response = curl_exec($ch);