{
  "slug": "call-cloudinary-from-vue-securely",
  "title": "Call cloudinary api from vue spa without secret key",
  "metaTitle": "Call cloudinary api from vue spa - RealComposer",
  "metaDescription": "Call cloudinary api from vue spa without secret key. Keep Cloudinary keys in RealComposer Vault; Vue / SPA uses rc_live_ tokens only.",
  "headline": "Media transforms without Cloudinary admin secrets",
  "category": "security",
  "categoryLabel": "Security & Secret Vault",
  "urgency": 9,
  "clientPlatform": "Vue / SPA",
  "upstreamServices": [
    "Cloudinary"
  ],
  "searchIntentQuery": "call cloudinary api from vue spa without secret key",
  "directAnswerSummary": "Upload and transform URLs signed at the edge with API secret in Vault. For \"call cloudinary api from vue spa without secret key\", store CLOUDINARY_BASIC_AUTH in Secret Vault, call https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/resources/image from a Worker, and let Vue / SPA hit only https://realcomposer.com/v1/workspace/call-cloudinary-from-vue-securely with an rc_live_ client token.",
  "problem": {
    "title": "Cloudinary keys in Vue / SPA network tabs",
    "explanation": "Vue / SPA ships code or scripts to end-user devices. Any Cloudinary bearer token in those bundles can be copied from DevTools, proxies, or repackaged apps.",
    "risks": [
      "Shared Vue / SPA projects revealing Cloudinary tokens",
      "Sudden Cloudinary quota burn from scripted abuse",
      "Inability to rotate keys without redeploying clients"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Bind vault keys to the Worker",
      "description": "Create CLOUDINARY_BASIC_AUTH vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders."
    },
    {
      "stepNumber": 2,
      "title": "Set headers, mapping, and cache TTL",
      "description": "Point step cloudinary at https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/resources/image with GET. Add output mapping fields that mirror the JSON contract your screen already expects. 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 Vue / SPA",
      "description": "Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.",
      "codeSnippet": "const { data } = await useFetch('https://realcomposer.com/v1/workspace/call-cloudinary-from-vue-securely', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Call cloudinary api from vue spa without secret key",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "cloudinary",
        "upstreamUrlTemplate": "https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/resources/image",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Basic {{secrets.CLOUDINARY_BASIC_AUTH}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "publicId",
          "sourcePath": "resources.0.public_id",
          "type": "string",
          "sourceStep": "cloudinary"
        },
        {
          "targetPath": "format",
          "sourcePath": "resources.0.format",
          "type": "string",
          "sourceStep": "cloudinary"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_call-clo",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "call-cloudinary-from-vue-securely"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "publicId": "sample",
    "format": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/call-cloudinary-from-vue-securely\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "What should Vue / SPA store instead of Cloudinary secrets?",
      "answer": "Point Vue / SPA at /recipes/call-cloudinary-from-vue-securely edge URL. RealComposer answers OPTIONS with Access-Control headers for allowed origins."
    },
    {
      "question": "Will Anthropic or Linear prompt bodies be rewritten?",
      "answer": "Cache key for call-cloudinary-from-vue-securely: internal edge-cache path plus sorted query. Identical params hit; vary userId per user."
    },
    {
      "question": "How do I rotate upstream credentials?",
      "answer": "Rotate vault secrets for call-cloudinary-from-vue-securely anytime; clients keep the same rc_live_ token."
    }
  ],
  "relatedRecipeSlugs": [
    "hide-api-key-vue-spa",
    "google-maps-api-proxy-edge"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/call-cloudinary-from-vue-securely",
    "markdown": "https://realcomposer.com/recipes/call-cloudinary-from-vue-securely.md",
    "json": "https://realcomposer.com/recipes/call-cloudinary-from-vue-securely.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=call-cloudinary-from-vue-securely&via=agent"
  }
}