Agent Skillsopenclaw/clawhub › convex-auth

convex-auth

GitHub

为 Convex 应用添加认证功能,自动安装 @convex-dev/auth 并配置 passkeys/OAuth。解决非交互环境下密钥生成难题,正确编写 auth.config.ts 避免静默登出,集成客户端组件并完成登录流程验证。

.agents/skills/convex-auth/SKILL.md openclaw/clawhub

Trigger Scenarios

需要为 Convex 应用添加登录功能 配置 Convex 应用的 Passkeys 或 OAuth 认证 修复 Convex 应用因 auth.config.ts 错误导致的静默登出问题

Install

npx skills add openclaw/clawhub --skill convex-auth -g -y
More Options

Non-standard path

npx skills add https://github.com/openclaw/clawhub/tree/main/.agents/skills/convex-auth -g -y

Use without installing

npx skills use openclaw/clawhub@convex-auth

指定 Agent (Claude Code)

npx skills add openclaw/clawhub --skill convex-auth -a claude-code -g -y

安装 repo 全部 skill

npx skills add openclaw/clawhub --all -g -y

预览 repo 内 skill

npx skills add openclaw/clawhub --list

SKILL.md

Frontmatter
{
    "name": "convex-auth",
    "description": "Add authentication (passkeys\/OAuth) to the current Convex app, including the auth.config.ts wiring."
}

Add sign-in to the app

Install and wire @convex-dev/auth for the current app: a provider (passkeys by default, or OAuth/password), the server config, the client hooks, and a sign-in UI — correctly, including the auth.config.ts that's the #1 real-world auth footgun.

Workflow

  1. Install @convex-dev/auth (pinned build) and add it to convex.config.ts. With pnpm, also pnpm add jose (it won't hoist otherwise); you need it for step 3.
  2. Add the provider in convex/auth.ts (Passkey by default; Password or OAuth like Google on request).
  3. Generate the auth keys HEADLESSLY. Do NOT run the interactive npx @convex-dev/auth wizard: it needs a login/TTY and hangs in non-interactive, anonymous, or CI runs (the #1 auth time-sink). Generate JWT_PRIVATE_KEY + JWKS deterministically with jose: node -e 'import("jose").then(async({generateKeyPair,exportPKCS8,exportJWK})=>{const k=await generateKeyPair("RS256",{extractable:true});const priv=await exportPKCS8(k.privateKey);const pub=await exportJWK(k.publicKey);process.stdout.write(JSON.stringify({JWT_PRIVATE_KEY:priv.trimEnd().replace(/\n/g," "),JWKS:JSON.stringify({keys:[{use:"sig",...pub}]})}))})' > .auth-keys.json Then set JWT_PRIVATE_KEY and JWKS (from .auth-keys.json) plus SITE_URL on the deployment. Prefer the Convex MCP envSet tool, one call per var, to avoid shell-quoting the multi-line key. CLI fallback: use the NAME=VALUE form (npx convex env set "JWT_PRIVATE_KEY=$JWT"), NEVER env set JWT_PRIVATE_KEY "$JWT" (the value starts with -----BEGIN and the CLI parses the leading - as an unknown flag). SITE_URL is the dev URL (e.g. http://localhost:3000). Delete .auth-keys.json after.
  4. Write convex/auth.config.ts (the silently-always-signed-out bug lives here if it's wrong).
  5. Wire the client: ConvexAuthProvider, the sign-in component, and route guards. If you import shadcn/ui primitives (button, input, textarea, label, and so on), add them first with npx shadcn@latest add <name>; a missing @/components/ui/* is a hard build error.
  6. Verify a sign-in round-trips before declaring done.

Rules

  • Generate JWT_PRIVATE_KEY/JWKS with jose (extractable RS256; PKCS8 newlines to spaces; JWKS = {keys:[{use:"sig", ...publicJwk}]}). Do NOT run the interactive npx @convex-dev/auth wizard: it hangs headless/anonymous. Set the vars via the MCP envSet tool or the NAME=VALUE CLI form.
  • Always write auth.config.ts: a missing/incorrect one makes the app silently always-signed-out with no error.
  • Passkeys by default; only switch to password/OAuth on explicit request.
  • Install any shadcn/ui primitive you import up front (npx shadcn@latest add ...); a missing @/components/ui/* is a hard build failure.
  • Verify a real sign-in works before finishing.

Version History

  • d6a8c68 Current 2026-08-20 02:43

Same Skill Collection

.agents/skills/autoreview/SKILL.md
.agents/skills/axiom-alerting/SKILL.md
.agents/skills/axiom-sre/SKILL.md
.agents/skills/building-dashboards/SKILL.md
.agents/skills/clawhub-content-rights-correspondence/SKILL.md
.agents/skills/clawhub-convex/SKILL.md
.agents/skills/clawhub-moderation/SKILL.md
.agents/skills/clawhub-pr-maintainer/SKILL.md
.agents/skills/clawhub-production-release/SKILL.md
.agents/skills/controlling-costs/SKILL.md
.agents/skills/convex-acquire-domain/SKILL.md
.agents/skills/convex-add/SKILL.md
.agents/skills/convex-advisor/SKILL.md
.agents/skills/convex-agent/SKILL.md
.agents/skills/convex-authz/SKILL.md
.agents/skills/convex-backup/SKILL.md
.agents/skills/convex-billing/SKILL.md
.agents/skills/convex-check-updates/SKILL.md
.agents/skills/convex-cost/SKILL.md
.agents/skills/convex-create-component/SKILL.md
.agents/skills/convex-crons/SKILL.md
.agents/skills/convex-deploy-guard/SKILL.md
.agents/skills/convex-design/SKILL.md
.agents/skills/convex-docs/SKILL.md
.agents/skills/convex-domains/SKILL.md
.agents/skills/convex-env/SKILL.md
.agents/skills/convex-expert/SKILL.md
.agents/skills/convex-explain-app/SKILL.md
.agents/skills/convex-improve-convex-plugin/SKILL.md
.agents/skills/convex-insights/SKILL.md
.agents/skills/convex-launch-readiness/SKILL.md
.agents/skills/convex-migrate-rehearse/SKILL.md
.agents/skills/convex-migrate/SKILL.md
.agents/skills/convex-migration-helper/SKILL.md
.agents/skills/convex-monitor/SKILL.md
.agents/skills/convex-optimize/SKILL.md
.agents/skills/convex-performance-audit/SKILL.md
.agents/skills/convex-quickstart/SKILL.md
.agents/skills/convex-retention/SKILL.md
.agents/skills/convex-reviewer/SKILL.md
.agents/skills/convex-self-heal/SKILL.md
.agents/skills/convex-sentinel/SKILL.md
.agents/skills/convex-setup-auth/SKILL.md
.agents/skills/convex-ship/SKILL.md
.agents/skills/convex-suggest/SKILL.md
.agents/skills/convex-test/SKILL.md
.agents/skills/convex-verify/SKILL.md
.agents/skills/create-and-cleanup-migration/SKILL.md
.agents/skills/openclaw-brand/SKILL.md

Metadata

Files
0
Version
d6a8c68
Hash
4909b6f3
Indexed
2026-08-20 02:43

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 09:36
浙ICP备14020137号-1 $mapa de visitantes$