Firebase Hosting — SPA Client
Real separate deploymentA public Auth0 client (Authorization Code + PKCE) using @auth0/auth0-spa-js · deployed as plain static files to classic Firebase Hosting, no build step, no server-side code at all · the only client in this suite with no server-held session of any kind
This runs on its own Firebase Hosting site with its own Auth0 application — log in there for real, view the decoded ID token claims and access token on the page itself, then log out.
Open the Firebase Hosting SPA demo| Traditional/BFF | Hono siblings | Firebase Hosting SPA | |
|---|---|---|---|
| Client type | Confidential (client secret) | Confidential (client secret) | Public (PKCE, no secret) |
| Where tokens live | Server — Firestore / encrypted cookie | Server — encrypted cookie (Hono siblings) | Browser memory only, never persisted |
| Hosting | Vercel Functions (Node.js) | Cloudflare Workers / Deno Deploy | Firebase Hosting — static files, zero server code |
| SDK | @auth0/nextjs-auth0 | @auth0/auth0-hono | @auth0/auth0-spa-js |
| On reload | Session cookie still valid — no re-auth needed | Session cookie still valid — no re-auth needed | Memory cache wiped — silent iframe re-auth attempt, or re-login |
| Revocation | Delete session record / Back-Channel Logout | Key rotation or TTL (no server record by default) | No session record ever existed — only the refresh token to revoke |
The Hono siblings vary the hosting platform while keeping the same confidential-client shape as Traditional/BFF. This demo varies the client type itself — public instead of confidential — and happens to also land on a third hosting platform that, unlike the others, never runs any application code at all: Firebase Hosting serves the same static HTML and JS file to every request, with no routing, no middleware, and no backend to compromise.
Traditional / BFF / Hono siblings (this suite)
Browser
Session cookie only — no tokens client-side
Server (Node.js / Workers / Deno)
Confidential client, holds tokens
Both
Auth0
Authorization Code + PKCE
Firebase Hosting SPA (this demo)
Browser
Public client, tokens held in memory
Firebase Hosting
Static files only — no server-side code at all
Strengths
- Genuinely zero server-side session anywhere in this demo — Firebase Hosting serves the same static HTML/JS file to every request and never executes any application code, which is a narrower attack surface than any confidential-client server in this suite (nothing to compromise server-side, because there is no server-side).
- Firebase Hosting serves over HTTPS with a CDN by default — no separate TLS setup, same baseline every static host in this suite gets for free.
- cacheLocation: 'memory' means tokens never touch localStorage or any persistent browser storage — closing the tab clears them completely, with no cleanup step required.
Risks & Considerations
- The redirect URI allowlist — not client ID secrecy — is this client type's actual security boundary. The client ID is public by design, not a leaked secret; a third party can reuse it in their own authorization requests, but cannot register a second application under it. Exact-match callback/logout/origin URLs, not wildcards, are what actually stops a malicious page from completing a login flow and receiving the resulting code.
- Memory-only token storage prevents theft at rest, but not active exfiltration: an attacker with script execution in this page's own origin (XSS) doesn't need to read any storage at all — they can simply call the already-running SDK's getTokenSilently() directly from the compromised page and get a live token handed to them.
- A page reload wipes the in-memory cache, so getTokenSilently() depends on a hidden-iframe round trip against Auth0's own SSO session cookie to avoid a full interactive re-login on every refresh — browsers that restrict third-party cookies in that context (increasingly the default) can silently degrade this demo to "re-login on every reload" with no error visible to the user beyond that.
- Refresh Token Rotation had to be explicitly enabled on this Auth0 application — setting useRefreshTokens: true in the SDK config alone is not sufficient for a public client; without the dashboard/API-side setting, the refresh exchange can fail without an obvious client-side signal pointing at the real cause.
Hardening Checklist
- A real, tested Content-Security-Policy, not a placeholder — explicit connect-src for the Auth0 domain's token/userinfo endpoints, script-src scoped to wherever the SDK is actually loaded from (the CDN origin here), frame-src the Auth0 domain for the silent-auth iframe, plus baseline object-src 'none' / base-uri 'none' — verified to still allow login, callback, token renewal, and logout to all succeed without relaxing to wildcards or unsafe-inline.
- Exact-match redirect URI allowlist on the Auth0 application, no wildcards — this is the client type's real security boundary, not the (public, non-secret) client ID.
- Configure a real API audience so the displayed access token is a genuine decodable JWT rather than an opaque token meant only for /userinfo — otherwise a demo risks teaching the wrong mental model about what access tokens look like.
- DPoP sender-constraining (already demoed elsewhere in this suite, /demo/spa) is a natural follow-up hardening step for a real deployment of this exact pattern — a stolen access token from an XSS-compromised page becomes far less useful if it's bound to a private key the attacker's script would also need to exfiltrate.