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.
This commit is contained in:
parent
83ba72ddc6
commit
3d3150bd20
1 changed files with 3 additions and 2 deletions
|
|
@ -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');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue