auth-simple

Protect Astro sites on Cloudflare Workers using a ladder from Cloudflare Access to Supabase Auth.

Updated Jun 17, 2026
One-click install
npx skills add https://github.com/ccediland/web-stack-skills --skill auth-simple-ccediland
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: auth-simple
Source: https://github.com/ccediland/web-stack-skills/tree/main/plugin/skills/auth-simple
Command: npx skills add https://github.com/ccediland/web-stack-skills --skill auth-simple-ccediland

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @supabase/ssr.

What problem does it solve? Choosing how to password-protect a site, gate a staging preview, or add a client portal login on a static Astro + Cloudflare Workers stack is full of traps: the documented Basic Auth example is non-production, and a custom cookie gate bills every protected request. This Skill provides a vetted decision ladder so you apply the least auth that does the job. ## Core Features & Use Cases - Cloudflare Access at the Worker level: Attach Access policies directly to a Worker with worker, preview_worker, or public destinations to gate previews, staging, or an /admin section — free for 50 users, no owned domain required for workers.dev. - Service tokens for CI: Let smoke tests and automation through protected environments with CF-Access-Client-Id/CF-Access-Client-Secret headers, no login flow. - Supabase Auth for real portals: Add @supabase/ssr login when real users own real data, with the required nodejs_compat flag and 2025+ compatibility date on Workers. - Use Case: A client asks to "put a password on the site" — instead of building a login form, you attach a preview_worker Access application via the account-level API, verify the OTP flow, and keep production public. ## Quick Start Use the auth-simple skill to protect the staging preview of my Astro site on Cloudflare Workers with Cloudflare Access.

Frequently Asked Questions about auth-simple

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I password-protect a staging site on Cloudflare Workers?▼

Attach a Cloudflare Access application with a `preview_worker` destination to the Worker, which gates only preview URLs while production stays public. Create it account-level via `POST /accounts/{id}/access/apps` with type `self_hosted`, destinations, and inline policies.

Cloudflare Access vs Basic Auth for protecting a Worker site?▼

Cloudflare Access is the production choice: free for 50 users, audited, and checked at the edge in front of the Worker. Cloudflare's own Basic Auth Worker example is explicitly labeled not suitable for production and requires nodejs_compat.

Does Cloudflare Access work with Workers Static Assets?▼

Yes, the Access check runs at the edge in front of the Worker and can gate paths like `/admin` on a static-assets-plus-Worker deployment, returning a 302 to the org login while sibling paths stay untouched. WebSocket connections are not supported by Worker-level Access policies.

Why does @supabase/ssr fail on Cloudflare Workers?▼

It fails at runtime with a "dynamic require of stream" error unless the wrangler config sets the `nodejs_compat` compatibility flag and a 2025+ compatibility_date. Set both before debugging anything else.

When should I use Supabase Auth instead of Cloudflare Access?▼

Use Supabase Auth only when real users own real data, such as a client portal with per-user records — the free tier covers 50,000 monthly active users. For previews, staging, or admin surfaces, Access is strictly simpler and free.

What are the limitations of a custom cookie auth gate on Workers?▼

A custom gate in front of static assets requires `run_worker_first`, so every matched request becomes a billed invocation against the shared 100k/day free cap with 429 failure risk. Access performs its check at the edge and avoids this billing trap.