Call Github API with Private Personal Access Token from Client
GitHub secrets stay out of Frontend / Web bundles
Frontend / Web cannot safely store GitHub production keys. Vault-bound headers reach https://api.github.com/user/repos?per_page=5 on Workers while apps call your github-api-private-token-proxy edge URL.
Why Frontend / Web leaks GitHub credentials
Attackers routinely extract GitHub secrets from Frontend / Web builds. Direct browser calls also expose internal error payloads with hostnames.
- Production GitHub keys copied from Frontend / Web bundles
- Compliance violations after credential leaks
- Attackers replaying vault-grade scopes from a laptop
How RealComposer Solves This at the Edge
Add vault secrets for this pipeline
Store GITHUB_TOKEN in the vault. Frontend / Web never embeds the raw secret, only a revocable rc_live_ client token.
Target the real upstream URL
Configure headersTemplate to inject vault secrets, target https://api.github.com/user/repos?per_page=5, and Add output mapping fields that mirror the JSON contract your screen already expects.
Call from Frontend / Web
Allowed origins on the token should list every Frontend / Web host that calls this URL.
const res = await fetch('https://realcomposer.com/v1/workspace/github-api-private-token-proxy', {
headers: { Authorization: 'Bearer rc_live_your_token' }
});
{
"requestId": "req_github-a",
"upstreamLatencyMs": 142,
"audit": {
"region": "edge",
"trace": "github-api-private-token-proxy"
},
"payload": {
"id": "sample_id",
"status": "active",
"nested": {
"tags": [
"demo"
],
"internal": true
},
"unused_blob": {
"foo": "bar",
"bar": "baz"
}
}
}
{
"repoId": "sample",
"fullName": "sample",
"isPrivate": "sample"
}
Recipe Specs
- HTTP method
- GET
- Upstream calls
- 1
- Edge cache TTL
- No caching
- Client auth
- Restricted client token
- Mapped output fields
- 3
- Payload
- 249 B to 60 B (-76%)
curl -X GET "https://realcomposer.com/v1/workspace/github-api-private-token-proxy" \ -H "Authorization: Bearer rc_live_client_token"
Developer Questions & Troubleshooting
Can Frontend / Web call GitHub without holding the production key?
Use scoped tokens where the vendor allows them on github-api-private-token-proxy. Admin keys stay {{secrets.*}} references only.
How do I forward JSON bodies to POST upstreams?
github-api-private-token-proxy keeps cache TTL at 0 because it uses POST upstream calls or per-user responses. Add ids to query strings before enabling GET cache.
How do I rotate upstream credentials?
Rotate vault secrets for github-api-private-token-proxy anytime; clients keep the same rc_live_ token.
Sources & Definitions Used in This Answer
Deploy this Frontend / Web + GitHub Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.