📄 SKILL.md

← Vault

name: painel-corretor-api-debug

description: Debug Auth0 JWT failures from server IPs to Painel do Corretor (Trindade) API — Cloudflare blocking server-origin requests

tags:

- painel-do-corretor

- auth0

- cloudflare

- n8n

- supabase


Painel do Corretor - Server-to-API Auth Debug

Problem

JWT Auth0 tokens that work perfectly in the user's browser fail with AUTH_NOT_AUTHORIZED or 403 AUTH when called from any server environment (n8n container, Supabase Edge Functions, VPS, AWS).

Root Cause

Painel do Corretor (Trindade Tecnologia) uses Cloudflare protection that blocks requests originating from known cloud/server IP ranges, even when a valid Auth0 JWT is provided.

Discovery Process

1. Tested n8n container → 403 AUTH from direct HTTPS calls to Painel API

2. Tested Supabase Edge Function (runs on AWS) → AUTH_NOT_AUTHORIZED from negociosElastic

3. Tested browser (same JWT) → 200 OK perfectly

4. Key headers that matter: origin: https://app2.paineldocorretor.com.br, referer: https://app2.paineldocorretor.com.br/crm/negocios, x-tenant: a1af7a2f-7ec6-40cd-b257-86c045875979, full browser User-Agent, sec-fetch-site: cross-site

5. Without these headers (n8n minimal HTTP client) → 400 Bad Request

Failed Solutions

Status

Blocked — permanent IP block. Solutions that avoid server-side HTTP calls needed (see alternatives below).

Alternative Approaches (viable)

1. Browser-based automation (Playwright/Puppeteer on residential IP) — runs on user's local machine with Brazilian IP

2. Auth0 refresh token rotation — get a refresh_token once, use it to generate new access_tokens server-side without the IP block issue (Auth0 API, not Painel API)

3. Residential proxy — route n8n's HTTP calls through a Brazilian residential proxy (e.g., Brightdata, ScraperAPI) with Brazilian IPs

4. User-provided fresh JWT — user manually captures JWT from browser and pastes into n8n credential; valid until expiry (~1 week)