From 9276dba00d3d45445a56faab6e2849c1a71d0cdb Mon Sep 17 00:00:00 2001 From: Marcos Fargas Date: Mon, 12 Oct 2026 20:45:56 +0200 Subject: [PATCH] fix(auth): support array bodies in integration authentication --- src/lib/integrations-auth.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/integrations-auth.ts b/src/lib/integrations-auth.ts index 09e3cdb..2138d37 100644 --- a/src/lib/integrations-auth.ts +++ b/src/lib/integrations-auth.ts @@ -51,14 +51,22 @@ export async function authenticateIntegrationRequest( req.nextUrl.searchParams.get('client_id'); if (!tenantId && options.parsedBody) { - tenantId = options.parsedBody.tenant_id || options.parsedBody.client_id; + if (Array.isArray(options.parsedBody)) { + tenantId = options.parsedBody[0]?.tenant_id || options.parsedBody[0]?.client_id; + } else { + tenantId = options.parsedBody.tenant_id || options.parsedBody.client_id; + } } if (!tenantId && req.method !== 'GET') { try { const cloned = req.clone(); const body = await cloned.json(); - tenantId = body.tenant_id || body.client_id; + if (Array.isArray(body)) { + tenantId = body[0]?.tenant_id || body[0]?.client_id; + } else { + tenantId = body.tenant_id || body.client_id; + } } catch { // Ignorar }