
Description
Add sign-in (passkeys by default, OAuth/password optional) to the current Convex app, wired correctly incl. auth.config.ts. TRIGGER on a login/auth request for an existing app.
SKILL.md
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.
Steps
- 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. - Add the provider in convex/auth.ts (Passkey by default; Password or OAuth like Google on request).
- Generate the auth keys HEADLESSLY. Do NOT run the interactive
npx @convex-dev/authwizard: 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 withjose: 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 MCPenvSettool, 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"), NEVERenv set JWT_PRIVATE_KEY "$JWT"(the value starts with-----BEGINand 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. - Write convex/auth.config.ts (the silently-always-signed-out bug lives here if it's wrong).
- 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. - 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 interactivenpx @convex-dev/authwizard: it hangs headless/anonymous. Set the vars via the MCPenvSettool 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.
More skills from the convex-codex-plugin repository
View all 19 skillsadd
add capabilities to Convex applications
Jul 12BackendConvexNext.jsagent
build AI agents with Convex
Jul 12AgentsEngineeringRAGSearchbilling
integrate Stripe billing in Convex apps
Jul 12ConvexPaymentsStripeWebhookscheck-updates
upgrade Convex component versions
Jul 12ConfigurationConvexMaintenanceconvex-authz
audit and harden Convex authorization
Jul 12AuthCode AnalysisConvexSecurityconvex-expert
develop Convex backend applications
Jul 18BackendConvexDatabaseTypeScript
More from Convex
View publisherconvex
guide Convex project setup and usage
agent-skills
Jul 12BackendConvexDatabaseconvex-create-component
build reusable Convex components
agent-skills
Jul 12API DevelopmentArchitectureBackendConvexconvex-migration-helper
plan Convex schema and data migrations
agent-skills
Jul 12BackendConvexData EngineeringMigrationconvex-performance-audit
audit Convex application performance
agent-skills
Jul 12ConvexDebuggingMonitoringPerformanceconvex-quickstart
initialize Convex in applications
agent-skills
Jul 12CLIConvexFrontendOnboardingconvex-setup-auth
set up authentication and access control
agent-skills
Jul 12Access ControlAuthBackendConvex