convex-setup-auth

Configure authentication and authorization for Convex applications with provider-specific setup.

Updated Jun 8, 2024
One-click install
npx skills add https://github.com/shadeiskndr/portfolio --skill convex-setup-auth-shadeiskndr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convex-setup-auth
Source: https://github.com/shadeiskndr/portfolio/tree/main/.agents/skills/convex-setup-auth
Command: npx skills add https://github.com/shadeiskndr/portfolio --skill convex-setup-auth-shadeiskndr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Convex apps need server-verified authentication and authorization, but setting up the correct provider wiring, identity mapping, protected queries, and environment configuration is easy to get wrong and hard to debug.

Core Features & Use Cases

  • Provider-first Convex Auth setup: Choose the correct Convex authentication approach (Convex Auth, Clerk, WorkOS AuthKit, Auth0, or a custom JWT) before changing backend wiring.
  • Identity mapping + protected functions: Implement server-side checks using ctx.auth.getUserIdentity() and avoid trusting client-provided user identifiers.
  • Minimal, correct user storage: Add app-level users tables and storage only when the app truly needs Convex user documents (especially avoiding parallel users flows for Convex Auth).

Quick Start

Ask the user which auth provider they want (or infer it from the repo) and then follow the matching reference guide to configure Convex auth, env vars, and protected backend functions.

Frequently Asked Questions about convex-setup-auth

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

FAQPage Schema
How do I add authentication to a Convex backend application?

To add authentication to a Convex backend, configure a chosen auth provider, wire server-side identity checks in protected functions using `ctx.auth.getUserIdentity()`, and apply environment variables for local and production environments.

What is the best way to protect Convex queries from unauthorized access?

The best way to protect Convex queries is by implementing server-side verification via `ctx.auth.getUserIdentity()` and creating role or ownership gates, ensuring you never trust client-provided user identifiers for access control decisions.

Does Convex authentication work with Clerk, WorkOS, and Auth0?

Yes, Convex authentication supports Clerk, WorkOS AuthKit, Auth0, custom JWTs, and native Convex Auth. You must follow provider-specific initialization and official documentation to configure the correct auth approach for your application.

Why does my Convex auth setup fail to verify user identity on the server?

Convex auth verification fails when trusting client-provided identifiers instead of using server-side `ctx.auth.getUserIdentity()`, or when provider-specific initialization and environment variables are incorrectly configured.

Do I need a custom users table in Convex when using Convex Auth?

You only need app-level `users` tables and storage when your app truly needs Convex user documents. Avoid creating parallel `users` flows, especially when using the native Convex Auth provider.