Skip to Content
v0.8.0 · shippedNative iOS / Android / Flutter / Capacitor SDKs, A2A discovery, SOC 2 readiness, residency, BYO storage, BYOK. Read the changelog →
Admin consoleDocs bridge
Not for direct use — powers docs ↔ admin SSO · · open live demo ↗

Docs bridge

Route: /docs-bridge

The docs bridge is a silent authentication relay used by the documentation site (docs.mushimushi.dev) to access Mushi APIs on behalf of a logged-in user — for example, to populate a live code snippet with your real API key, or to show project-specific setup instructions.

You will never navigate here directly. The docs site opens /docs-bridge as a popup or iframe, the bridge posts a token back, and the popup closes automatically.


How it works

  1. The docs site detects that it needs a Mushi session token.
  2. It opens app.mushimushi.dev/docs-bridge?nonce=<one-time-nonce>&returnOrigin=<docs-origin> as a popup.
  3. The bridge page:
    • Reads the ?nonce= and ?returnOrigin= query parameters.
    • Calls supabase.auth.refreshSession() to ensure the token is fresh.
    • Posts the access token to the opener via window.postMessage (origin-checked against returnOrigin).
    • Closes itself 500ms later.
  4. The docs site receives the token and uses it for a single API call, then discards it.

Status messages

The bridge page shows a minimal status card while running:

StatusMeaning
Connecting…Retrieving session and preparing to post
Docs sync connectedToken posted successfully — the popup will close
Sign in firstNo active Mushi session — log in at app.mushimushi.dev first
Missing nonceThe ?nonce= parameter was absent — the docs site sent a malformed URL
Invalid originreturnOrigin is not an allowed docs origin
Can’t talk back to docs windowThe opener window was closed before the token could be posted

Security

  • The bridge validates returnOrigin against an allow-list of Mushi-owned docs origins. An attacker cannot use this route to steal tokens by pointing returnOrigin to an arbitrary domain.
  • The nonce is a one-time value generated by the docs site per request.
  • No Mushi API calls are made — the bridge only refreshes the Supabase session token.

  • Projects — if you need a persistent API key for scripts or CI, generate one here instead
  • MCP — for AI assistant integrations that need API access
Last updated on