Hide salesforce api credentials in javascript client app
Keep Salesforce tokens off the browser
Edge pipeline attaches Bearer tokens so static sites never embed secrets. For "hide salesforce api credentials in javascript client app", 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 JavaScript / HTML hit only https://realcomposer.com/v1/workspace/hide-salesforce-credentials-javascript with an rc_live_ client token.
Why JavaScript / HTML leaks Salesforce credentials
Attackers routinely extract Salesforce secrets from JavaScript / HTML builds. Direct browser calls also expose internal error payloads with hostnames.
- Production Salesforce keys copied from JavaScript / HTML bundles
- Compliance violations after credential leaks
- Attackers replaying vault-grade scopes from a laptop
How RealComposer Solves This at the Edge
Store upstream credentials in Secret Vault
Create SALESFORCE_ACCESS_TOKEN vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders.
Configure upstream steps and output mapping
Use GET against https://{{secrets.SALESFORCE_INSTANCE}}.my.salesforce.com/services/data/v68.0/sobjects/Contact/{{query.contactId}}. 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).
Call from JavaScript / HTML
Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.
const data = await fetch('https://realcomposer.com/v1/workspace/hide-salesforce-credentials-javascript', {
headers: { Authorization: 'Bearer rc_live_your_token' }
}).then(r => r.json());
{
"requestId": "req_hide-sal",
"upstreamLatencyMs": 142,
"audit": {
"region": "edge",
"trace": "hide-salesforce-credentials-javascript"
},
"payload": {
"id": "sample_id",
"status": "active",
"nested": {
"tags": [
"demo"
],
"internal": true
},
"unused_blob": {
"foo": "bar",
"bar": "baz"
}
}
}
{
"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
- 257 B to 55 B (-79%)
curl -X GET "https://realcomposer.com/v1/workspace/hide-salesforce-credentials-javascript" \ -H "Authorization: Bearer rc_live_client_token"
Developer Questions & Troubleshooting
What should JavaScript / HTML store instead of Salesforce secrets?
Yes for hide-salesforce-credentials-javascript. Ship only an rc_live_ client token in JavaScript / HTML; RealComposer injects SALESFORCE_ACCESS_TOKEN on https://{{secrets.SALESFORCE_INSTANCE}}.my.salesforce.com/services/data/v68.0/sobjects/Contact/{{query.contactId}}.
Will Anthropic or Linear prompt bodies be rewritten?
hide-salesforce-credentials-javascript forwards client JSON to POST upstreams unchanged; secrets interpolate only in URLs and header templates.
Can I restrict which domains call this pipeline?
Upstream steps in hide-salesforce-credentials-javascript honor timeoutMs and optional fallback JSON without leaking secrets.
Sources & Definitions Used in This Answer
Deploy this JavaScript / HTML + Salesforce Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.