cloudflare-workers-pat-bearer-auth - Add PAT Bearer authentication to Cloudflare Workers
Adds per-user personal access token authentication to a Hono and D1 Cloudflare Worker alongside cookie sessions.
Tags
Updated: 2026-11-11Capabilities
Typical Inputs
Typical Outputs
What this skill does
- Mint personal access tokens
- Hash tokens with pepper
- Validate Bearer credentials
- Authenticate before cookie sessions
- Require session-only token management
- Enforce resource scopes
- Skip CSRF for Bearer
- Track token usage hourly
- Revoke individual tokens
- Publish caller contracts
Inputs
- Existing cookie-session layer
- PAT pepper secret
- Token name
- Token scopes
- Token expiry
- Caller environment variable
- Receiver base URL
- Request body schema
Outputs
- Bearer access tokens
- Token hash records
- Authentication context
- Scoped authenticated requests
- Token management routes
- Token revocation state
- Caller documentation
- Published JSON Schema
Requirements
- Claude Code or similar agent
- Cloudflare Workers runtime
- Hono 4
- Drizzle ORM
- D1 SQLite database
- WebCrypto support
- Existing cookie sessions
- wrangler CLI
- PAT_PEPPER secret
- pnpm toolchain
