From 2e3ce44e7b1234b66bb560e07be513ade4e3aca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoni=20Nu=C3=B1ez=20Romeu?= Date: Mon, 13 Jul 2026 17:05:37 +0200 Subject: [PATCH] fix(backend): remove auth from OFF read operations - READ operations don't require auth per OFF docs (only User-Agent) - Auth credentials were causing 503 errors - Keep User-Agent header which is required --- apps/backend/off-service.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/backend/off-service.js b/apps/backend/off-service.js index 9dde7ad..990089d 100644 --- a/apps/backend/off-service.js +++ b/apps/backend/off-service.js @@ -83,13 +83,13 @@ export async function searchBabyProducts(query) { } console.log(`Fetching from OFF API: ${searchTerm}`); - const auth = getOffAuth(); const headers = getOffHeaders(); let lastError; for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) { try { // Use v2 structured search with brand filter (more reliable than /cgi/search.pl) + // READ operations don't require auth per OFF docs, only User-Agent const response = await axios.get(`${OFF_API_BASE}/api/v2/search`, { params: { brands_tags: searchTerm, @@ -98,7 +98,6 @@ export async function searchBabyProducts(query) { headers, timeout: 10000, validateStatus: (status) => status === 200, - ...(auth && { auth }), }); // Check if response is actually JSON (OFF sometimes returns HTML on error) @@ -159,14 +158,13 @@ export async function getBabyProductDetails(barcode) { } console.log(`Fetching OFF product details: ${barcode}`); - const auth = getOffAuth(); const headers = getOffHeaders(); // Use v3 API (recommended) for product details + // READ operations don't require auth per OFF docs, only User-Agent const response = await axios.get(`${OFF_API_BASE}/api/v3/product/${barcode}.json`, { headers, timeout: 10000, validateStatus: (status) => status === 200, - ...(auth && { auth }), }); if (response.data && response.data.product) {