From 2db69b7f28dabd8a0cb8d5aec6c6e5bd041f98a8 Mon Sep 17 00:00:00 2001 From: DJP Date: Tue, 18 Nov 2025 09:11:00 -0500 Subject: [PATCH] Try multiple authorization header formats for OMG API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- OMGService.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/OMGService.php b/OMGService.php index 453cfdd..503f613 100644 --- a/OMGService.php +++ b/OMGService.php @@ -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);