RealComposer
ReactSalesforceSecurity & Secret Vault

Call salesforce api from react without exposing access token

Secure Salesforce REST proxy for React SPAs

Direct Answer & Architecture Summary

Vault-inject OAuth or integration tokens at the edge; React calls one public client token URL. For "call salesforce api from react without exposing access token", store SALESFORCE_ACCESS_TOKEN in Secret Vault, call https://{{secrets.SALESFORCE_INSTANCE}}.my.salesforce.com/services/data/v68.0/sobjects/Contact/{{query.contactId}} from a Worker, and let React hit only https://realcomposer.com/v1/workspace/call-salesforce-api-from-react-securely with an rc_live_ client token.

Security LevelAES-256-GCM Vault
Edge LatencySub-10ms Response
InfrastructureZero Server Maintenance
The Problem Solved

Why React leaks Salesforce credentials

Attackers routinely extract Salesforce secrets from React builds. Direct browser calls also expose internal error payloads with hostnames.

Critical Security & Operational Risks:
  • Production Salesforce keys copied from React bundles
  • Compliance violations after credential leaks
  • Attackers replaying vault-grade scopes from a laptop
Architecture & Step-by-Step Implementation

How RealComposer Solves This at the Edge

1

Store upstream credentials in Secret Vault

Store SALESFORCE_ACCESS_TOKEN in the vault. React never embeds the raw secret, only a revocable rc_live_ client token.

2

Configure upstream steps and output mapping

Configure headersTemplate to inject vault secrets, target https://{{secrets.SALESFORCE_INSTANCE}}.my.salesforce.com/services/data/v68.0/sobjects/Contact/{{query.contactId}}, and Add output mapping fields that mirror the JSON contract your screen already expects.

3

Call from React

Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.

                    const res = await fetch('https://realcomposer.com/v1/workspace/call-salesforce-api-from-react-securely', {
  headers: { Authorization: 'Bearer rc_live_your_token' }
});
const data = await res.json();
                  
Payload Slimming Comparison
79% Bandwidth Reduction
Raw Upstream Response258 B
              {
  "requestId": "req_call-sal",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "call-salesforce-api-from-react-securely"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
            
RealComposer Slimmed Edge Payload55 B
              {
  "contactId": "sample",
  "email": "sample",
  "name": "sample"
}
            

Recipe Specs

HTTP method
GET
Upstream calls
1
Edge cache TTL
No caching
Client auth
Restricted client token
Mapped output fields
3
Payload
258 B to 55 B (-79%)
Call from Terminal or Client
curl -X GET "https://realcomposer.com/v1/workspace/call-salesforce-api-from-react-securely" \
  -H "Authorization: Bearer rc_live_client_token"
Frequently Asked Questions

Developer Questions & Troubleshooting

Which Salesforce credential belongs in the vault for this pipeline?

Point React at /recipes/call-salesforce-api-from-react-securely edge URL. RealComposer answers OPTIONS with Access-Control headers for allowed origins.

Does POST traffic get cached?

Cache key for call-salesforce-api-from-react-securely: internal edge-cache path plus sorted query. Identical params hit; vary userId per user.

How do I rotate upstream credentials?

Upstream steps in call-salesforce-api-from-react-securely honor timeoutMs and optional fallback JSON without leaking secrets.

Sources & Definitions Used in This Answer

Instant Deployment

Deploy this React + Salesforce Recipe

Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.

CLONE THIS RECIPE
Related Architecture Recipes