{
  "slug": "google-maps-api-proxy-edge",
  "title": "Hide Google Maps API Key in Web App",
  "metaDescription": "Hide google maps api key in web app. Keep Google Maps keys in RealComposer Vault; Frontend / Web uses rc_live_ tokens only.",
  "headline": "Google Maps secrets stay out of Frontend / Web bundles",
  "category": "security",
  "categoryLabel": "Security & Secret Vault",
  "urgency": 8,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "Google Maps"
  ],
  "searchIntentQuery": "hide google maps api key in web app",
  "directAnswerSummary": "Frontend / Web cannot safely store Google Maps production keys. Vault-bound headers reach https://maps.googleapis.com/maps/api/place/autocomplete/json?input={{query.input}}&key={{secrets.GOOGLE_MAPS_API_KEY}} on Workers while apps call your google-maps-api-proxy-edge edge URL.",
  "problem": {
    "title": "Why Frontend / Web leaks Google Maps credentials",
    "explanation": "Attackers routinely extract Google Maps secrets from Frontend / Web builds. Direct browser calls also expose internal error payloads with hostnames.",
    "risks": [
      "Production Google Maps keys copied from Frontend / Web bundles",
      "Compliance violations after credential leaks",
      "Attackers replaying vault-grade scopes from a laptop"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Add vault secrets for this pipeline",
      "description": "Create GOOGLE_MAPS_API_KEY vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders."
    },
    {
      "stepNumber": 2,
      "title": "Target the real upstream URL",
      "description": "Use GET against https://maps.googleapis.com/maps/api/place/autocomplete/json?input={{query.input}}&key={{secrets.GOOGLE_MAPS_API_KEY}}. 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 Frontend / Web",
      "description": "Allowed origins on the token should list every Frontend / Web host that calls this URL.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/google-maps-api-proxy-edge', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Hide Google Maps API Key in Web App",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "maps",
        "upstreamUrlTemplate": "https://maps.googleapis.com/maps/api/place/autocomplete/json?input={{query.input}}&key={{secrets.GOOGLE_MAPS_API_KEY}}",
        "httpMethod": "GET",
        "headersTemplate": {},
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "description",
          "sourcePath": "predictions.0.description",
          "type": "string",
          "sourceStep": "maps"
        },
        {
          "targetPath": "placeId",
          "sourcePath": "predictions.0.place_id",
          "type": "string",
          "sourceStep": "maps"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_google-m",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "google-maps-api-proxy-edge"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "description": "sample",
    "placeId": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/google-maps-api-proxy-edge\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Is it safe to log Google Maps responses in Frontend / Web?",
      "answer": "Store GOOGLE_MAPS_API_KEY for google-maps-api-proxy-edge. Frontend / Web never sees decrypted values."
    },
    {
      "question": "When does edge caching apply to this recipe?",
      "answer": "google-maps-api-proxy-edge vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body."
    },
    {
      "question": "How do I rotate upstream credentials?",
      "answer": "Rotate vault secrets for google-maps-api-proxy-edge anytime; clients keep the same rc_live_ token."
    }
  ],
  "relatedRecipeSlugs": [
    "filter-empty-hubspot-properties",
    "combine-supabase-user-with-billing-api",
    "call-airtable-from-flutterflow-securely"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/google-maps-api-proxy-edge",
    "markdown": "https://realcomposer.com/recipes/google-maps-api-proxy-edge.md",
    "json": "https://realcomposer.com/recipes/google-maps-api-proxy-edge.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=google-maps-api-proxy-edge&via=agent"
  }
}