{
  "slug": "hide-intercom-access-token-react",
  "title": "Hide intercom access token in react app",
  "metaDescription": "Hide intercom access token in react app. Intercom contacts and events via edge proxy with server. Keep Intercom keys in RealComposer Vault; React uses.",
  "headline": "User lookup for in-app messaging without leaks",
  "category": "security",
  "categoryLabel": "Security & Secret Vault",
  "urgency": 9,
  "clientPlatform": "React",
  "upstreamServices": [
    "Intercom"
  ],
  "searchIntentQuery": "hide intercom access token in react app",
  "directAnswerSummary": "Intercom contacts and events via edge proxy with server-side Bearer token. For \"hide intercom access token in react app\", store INTERCOM_ACCESS_TOKEN in Secret Vault, call https://api.intercom.io/contacts from a Worker, and let React hit only https://realcomposer.com/v1/workspace/hide-intercom-access-token-react with an rc_live_ client token.",
  "problem": {
    "title": "Why React leaks Intercom credentials",
    "explanation": "Attackers routinely extract Intercom secrets from React builds. Direct browser calls also expose internal error payloads with hostnames.",
    "risks": [
      "Production Intercom keys copied from React bundles",
      "Compliance violations after credential leaks",
      "Attackers replaying vault-grade scopes from a laptop"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Store upstream credentials in Secret Vault",
      "description": "Add INTERCOM_ACCESS_TOKEN to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream."
    },
    {
      "stepNumber": 2,
      "title": "Target the real upstream URL",
      "description": "Use GET against https://api.intercom.io/contacts. Allowed origins on the client token should match leave cache ttl at 0 when each response is user-specific (include userid or record id in query params before enabling cache)."
    },
    {
      "stepNumber": 3,
      "title": "Call from React",
      "description": "Allowed origins on the token should list every React host that calls this URL.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/hide-intercom-access-token-react', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});\nconst data = await res.json();"
    }
  ],
  "pipelineConfig": {
    "name": "Hide intercom access token in react app",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "intercom",
        "upstreamUrlTemplate": "https://api.intercom.io/contacts",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.INTERCOM_ACCESS_TOKEN}}",
          "Accept": "application/json"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "contactId",
          "sourcePath": "data.0.id",
          "type": "string",
          "sourceStep": "intercom"
        },
        {
          "targetPath": "email",
          "sourcePath": "data.0.email",
          "type": "string",
          "sourceStep": "intercom"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_hide-int",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "hide-intercom-access-token-react"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "contactId": "sample",
    "email": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/hide-intercom-access-token-react\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Which Intercom credential belongs in the vault for this pipeline?",
      "answer": "Log request IDs for hide-intercom-access-token-react, not raw Intercom payloads, because upstream bodies may include PII."
    },
    {
      "question": "What cache key does RealComposer use?",
      "answer": "hide-intercom-access-token-react vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body."
    },
    {
      "question": "Can I restrict which domains call this pipeline?",
      "answer": "Upstream steps in hide-intercom-access-token-react honor timeoutMs and optional fallback JSON without leaking secrets."
    }
  ],
  "relatedRecipeSlugs": [
    "clerk-backend-api-proxy",
    "hide-openai-api-key-react"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/hide-intercom-access-token-react",
    "markdown": "https://realcomposer.com/recipes/hide-intercom-access-token-react.md",
    "json": "https://realcomposer.com/recipes/hide-intercom-access-token-react.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=hide-intercom-access-token-react&via=agent"
  }
}