From 68f0da7351373079c1141c1ab9db38f4f3e02254 Mon Sep 17 00:00:00 2001 From: Mazen Khalil Date: Wed, 28 Jan 2026 10:50:14 +0300 Subject: [PATCH] fix: Attachments download authentication issue in Tiktok (#13151) Fixes https://linear.app/chatwoot/issue/CW-6357/ensure-authentication-when-fetching-attachments Update the attachment download method to include the access token in the request headers, ensuring proper authentication when fetching attachments. https://business-api.tiktok.com/portal/docs?id=1832184455450626 Co-authored-by: Muhsin Keloth --- app/services/tiktok/messaging_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/tiktok/messaging_helpers.rb b/app/services/tiktok/messaging_helpers.rb index 0f167a3e0..0e580c21b 100644 --- a/app/services/tiktok/messaging_helpers.rb +++ b/app/services/tiktok/messaging_helpers.rb @@ -59,7 +59,7 @@ module Tiktok::MessagingHelpers def fetch_attachment(channel, tt_conversation_id, tt_message_id, tt_image_media_id) file_download_url = tiktok_client(channel).file_download_url(tt_conversation_id, tt_message_id, tt_image_media_id) - Down.download(file_download_url) + Down.download(file_download_url, headers: { 'x-user' => channel.validated_access_token }) end def tiktok_client(channel)