Update: 2026-07-10 13:41:34

This commit is contained in:
Hamza-Ayed
2026-07-10 13:41:34 +03:00
parent be6e5bed92
commit 5fb2c25504
3 changed files with 11 additions and 3 deletions
+8
View File
@@ -85,6 +85,12 @@ function getNabehBearerToken(): ?string {
$response = curlCall("POST", $apiUrl, json_encode($payload), [
'Content-Type: application/json'
]);
$debugLog = "[ " . date('Y-m-d H:i:s') . " ]\n";
$debugLog .= "Request to: $apiUrl\n";
$debugLog .= "Payload: " . json_encode($payload) . "\n";
$debugLog .= "Response: " . $response . "\n";
file_put_contents(__DIR__ . '/../../../logs/nabeh_debug.txt', $debugLog, FILE_APPEND);
if ($response) {
$decoded = json_decode($response, true);
@@ -95,6 +101,8 @@ function getNabehBearerToken(): ?string {
if ($redis) {
try {
$redis->setex('nabeh_bearer_token', 86400, $token);
$debugLog = "Token cached in Redis successfully.\n";
file_put_contents(__DIR__ . '/../../../logs/nabeh_debug.txt', $debugLog, FILE_APPEND);
} catch (Exception $e) {
$msg = "⚠️ [Nabeh Auth Redis Cache Save] Error saving token: " . $e->getMessage();
error_log($msg);