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:
parent
6c8c8ea508
commit
2db69b7f28
1 changed files with 11 additions and 4 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue