From 3d3150bd2008e9e1791198bee58718edd89aeb28 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Fri, 3 Jul 2026 11:26:48 -0300 Subject: [PATCH] Redact the Threads token-exchange failure logs The connect flow logged the raw response body of a failed token exchange, unlike the TokenRedactor discipline used everywhere else. A failure body carries no token, but redacting keeps it consistent and defensive. --- app/Http/Controllers/Auth/ThreadsController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Auth/ThreadsController.php b/app/Http/Controllers/Auth/ThreadsController.php index 6b29e568..059b173e 100644 --- a/app/Http/Controllers/Auth/ThreadsController.php +++ b/app/Http/Controllers/Auth/ThreadsController.php @@ -8,6 +8,7 @@ use App\Enums\SocialAccount\Status; use App\Exceptions\SocialAccount\NetworkAlreadyConnectedException; use App\Models\Workspace; +use App\Services\Social\TokenRedactor; use Illuminate\Http\Request; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; @@ -90,7 +91,7 @@ public function callback(Request $request): InertiaResponse if ($tokenResponse->failed()) { Log::error('Threads token exchange failed', [ 'status' => $tokenResponse->status(), - 'body' => $tokenResponse->body(), + 'body' => TokenRedactor::redact($tokenResponse->body()), ]); throw new \Exception('Failed to exchange token'); } @@ -109,7 +110,7 @@ public function callback(Request $request): InertiaResponse if ($longLivedResponse->failed()) { Log::error('Threads long-lived token exchange failed', [ 'status' => $longLivedResponse->status(), - 'body' => $longLivedResponse->body(), + 'body' => TokenRedactor::redact($longLivedResponse->body()), ]); throw new \Exception('Failed to exchange long-lived token'); }