Stitch firebase with clerk session bootstrap
Mobile launch auth plus push config
Clerk session and Firebase FCM registration merged at startup. For "stitch firebase with clerk session bootstrap", store FIREBASE_ACCESS_TOKEN, CLERK_SECRET_KEY in Secret Vault, call https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}} from a Worker, and let React Native hit only https://realcomposer.com/v1/workspace/stitch-firebase-with-clerk-bootstrap with an rc_live_ client token.
Serial Firebase and Clerk calls slow React Native pages
Each extra Firebase and Clerk hop adds hundreds of milliseconds and another OAuth refresh path your UI must manage.
- One slow upstream blocking an entire page
- Partial failures leaving UI in inconsistent states
- Duplicate auth refresh logic per service
How RealComposer Solves This at the Edge
Add vault secrets for this pipeline
Add FIREBASE_ACCESS_TOKEN, CLERK_SECRET_KEY to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream.
Set headers, mapping, and cache TTL
Use GET against https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}}. 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 React Native
Call https://realcomposer.com/v1/workspace/stitch-firebase-with-clerk-bootstrap with a restricted rc_live_ client token. React Native never sends upstream secrets.
const res = await fetch('https://realcomposer.com/v1/workspace/stitch-firebase-with-clerk-bootstrap', {
headers: { Authorization: 'Bearer rc_live_your_token' }
});
{
"requestId": "req_stitch-f",
"upstreamLatencyMs": 142,
"audit": {
"region": "edge",
"trace": "stitch-firebase-with-clerk-bootstrap"
},
"payload": {
"id": "sample_id",
"status": "active",
"nested": {
"tags": [
"demo"
],
"internal": true
},
"unused_blob": {
"foo": "bar",
"bar": "baz"
}
}
}
{
"firebase_docName": "sample",
"firebase_fields": "sample",
"clerk_userId": "sample",
"clerk_email": "sample"
}
Recipe Specs
- HTTP method
- GET
- Upstream calls
- 2
- Edge cache TTL
- No caching
- Client auth
- Restricted client token
- Mapped output fields
- 4
- Payload
- 255 B to 103 B (-60%)
curl -X GET "https://realcomposer.com/v1/workspace/stitch-firebase-with-clerk-bootstrap" \ -H "Authorization: Bearer rc_live_client_token"
Developer Questions & Troubleshooting
What should React Native store instead of Firebase secrets?
Yes for stitch-firebase-with-clerk-bootstrap. Ship only an rc_live_ client token in React Native; RealComposer injects FIREBASE_ACCESS_TOKEN on https://firestore.googleapis.com/v1/projects/{{query.projectId}}/databases/(default)/documents/{{query.collection}}/{{query.docId}}.
Will Anthropic or Linear prompt bodies be rewritten?
stitch-firebase-with-clerk-bootstrap POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard.
What happens if an upstream step times out?
Rotate vault secrets for stitch-firebase-with-clerk-bootstrap anytime; clients keep the same rc_live_ token.
Sources & Definitions Used in This Answer
- DefinitionOpenID Connect (OIDC)
- DefinitionToken Introspection
- DefinitionSAML Single Sign-On
- DefinitionSingle Sign-On (SSO)
- DefinitionFederated Identity
- Stack guideReact Native safe & unsafe practices
- Stack guideFirebase safe & unsafe practices
- Stack guideClerk safe & unsafe practices
- Official docsReact Native documentation
- Official docsFirebase documentation
- Official docsClerk documentation
Deploy this React Native + Firebase, Clerk Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.