Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
get-convex avatar

Convex Setup Auth

  • 91.8k installs
  • 41 repo stars
  • Updated July 13, 2026
  • get-convex/agent-skills

convex-setup-auth is an agent skill that guides developers through implementing end-to-end authentication and role-based access control in Convex applications.

About

Agent skill for setting up end-to-end authentication in Convex applications. Guides developers through configuring auth providers, identity mapping, and role-based access control patterns.

  • End-to-end authentication setup for Convex
  • User identity mapping and access control
  • Role-based authorization patterns

Convex Setup Auth by the numbers

  • 91,796 all-time installs (skills.sh)
  • +4,628 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #8 of 4,386 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

convex-setup-auth capabilities & compatibility

Use cases
api development
Pricing
Free
npx skills add https://github.com/get-convex/agent-skills --skill convex-setup-auth

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs91.8k
repo stars41
Security audit3 / 3 scanners passed
Last updatedJuly 13, 2026
Repositoryget-convex/agent-skills

How do you set up auth in a Convex backend?

Implement end-to-end authentication and user identity management in Convex backends

Who is it for?

Setting up authentication in new or existing Convex backends

Skip if: Projects using a non-Convex backend or teams that only need generic OAuth/OIDC docs without Convex function guards.

When should I use this skill?

Developer needs to implement authentication and access control in Convex

What you get

Users table, identity helpers, provider configuration, and protected Convex function access patterns.

  • Users table schema
  • Auth helper functions
  • Protected query and mutation patterns

By the numbers

  • Documents 5 auth integration paths: Convex Auth, Clerk, WorkOS AuthKit, Auth0, and custom JWT

Files

SKILL.mdMarkdownGitHub ↗

Convex Authentication Setup

Implement secure authentication in Convex with user management and access control.

When to Use

  • Setting up authentication for the first time
  • Implementing user management (users table, identity mapping)
  • Creating authentication helper functions
  • Setting up auth providers (Convex Auth, Clerk, WorkOS AuthKit, Auth0, custom

JWT)

When Not to Use

  • Auth for a non-Convex backend
  • Pure OAuth/OIDC documentation without a Convex implementation
  • Debugging unrelated bugs that happen to surface near auth code
  • The auth provider is already fully configured and the user only needs a

one-line fix

First Step: Choose the Auth Provider

Convex supports multiple authentication approaches. Do not assume a provider.

Before writing setup code:

1. Ask the user which auth solution they want, unless the repository already makes it obvious 2. If the repo already uses a provider, continue with that provider unless the user wants to switch 3. If the user has not chosen a provider and the repo does not make it obvious, ask before proceeding

Common options:

the user wants auth handled directly in Convex

  • Clerk - use when the app already uses

Clerk or the user wants Clerk's hosted auth features

already uses WorkOS or the user wants AuthKit specifically

  • Auth0 - use when the app already uses

Auth0

  • Custom JWT provider - use when integrating an existing auth system not covered

above

Look for signals in the repo before asking:

  • Dependencies such as @clerk/*, @workos-inc/*, @auth0/*, or Convex Auth

packages

  • Existing files such as convex/auth.config.ts, auth middleware, provider

wrappers, or login components

  • Environment variables that clearly point at a provider

After Choosing a Provider

Read the provider's official guide and the matching local reference file:

references/convex-auth.md

references/clerk.md

references/workos-authkit.md

references/auth0.md

The local reference files contain the concrete workflow, expected files and env vars, gotchas, and validation checks.

Use those sources for:

  • package installation
  • client provider wiring
  • environment variables
  • convex/auth.config.ts setup
  • login and logout UI patterns
  • framework-specific setup for React, Vite, or Next.js

For shared auth behavior, use the official Convex docs as the source of truth:

ctx.auth.getUserIdentity()

for optional app-level user storage

authorization guidance

provider is Convex Auth

Prefer official docs over recalled steps, because provider CLIs and Convex Auth internals change between versions. Inventing setup from memory risks outdated patterns. For third-party providers, only add app-level user storage if the app actually needs user documents in Convex. Not every app needs a users table. For Convex Auth, follow the Convex Auth docs and built-in auth tables rather than adding a parallel users table plus storeUser flow, because Convex Auth already manages user records internally. After running provider initialization commands, verify generated files and complete the post-init wiring steps the provider reference calls out. Initialization commands rarely finish the entire integration.

Core Pattern: Protecting Backend Functions

The most common auth task is checking identity in Convex functions.

// Bad: trusting a client-provided userId
export const getMyProfile = query({
  args: { userId: v.id("users") },
  handler: async (ctx, args) => {
    return await ctx.db.get(args.userId);
  },
});
// Good: verifying identity server-side
export const getMyProfile = query({
  args: {},
  handler: async (ctx) => {
    const identity = await ctx.auth.getUserIdentity();
    if (!identity) throw new Error("Not authenticated");

    return await ctx.db
      .query("users")
      .withIndex("by_tokenIdentifier", (q) =>
        q.eq("tokenIdentifier", identity.tokenIdentifier),
      )
      .unique();
  },
});

Workflow

1. Determine the provider, either by asking the user or inferring from the repo 2. Ask whether the user wants local-only setup or production-ready setup now 3. Read the matching provider reference file 4. Follow the official provider docs for current setup details 5. Follow the official Convex docs for shared backend auth behavior, user storage, and authorization patterns 6. Only add app-level user storage if the docs and app requirements call for it 7. Add authorization checks for ownership, roles, or team access only where the app needs them 8. Verify login state, protected queries, environment variables, and production configuration if requested

If the flow blocks on interactive provider or deployment setup, ask the user explicitly for the exact human step needed, then continue after they complete it. For UI-facing auth flows, offer to validate the real sign-up or sign-in flow after setup is done. If the environment has browser automation tools, you can use them. If it does not, give the user a short manual validation checklist instead.

Reference Files

Provider References

  • references/convex-auth.md
  • references/clerk.md
  • references/workos-authkit.md
  • references/auth0.md

Checklist

  • [ ] Chosen the correct auth provider before writing setup code
  • [ ] Read the relevant provider reference file
  • [ ] Asked whether the user wants local-only setup or production-ready setup
  • [ ] Used the official provider docs for provider-specific wiring
  • [ ] Used the official Convex docs for shared auth behavior and authorization

patterns

  • [ ] Only added app-level user storage if the app actually needs it
  • [ ] Did not invent a cross-provider users table or storeUser flow for

Convex Auth

  • [ ] Added authentication checks in protected backend functions
  • [ ] Added authorization checks where the app actually needs them
  • [ ] Clear error messages ("Not authenticated", "Unauthorized")
  • [ ] Client auth provider configured for the chosen provider
  • [ ] If requested, production auth setup is covered too

Related skills

FAQ

Which auth providers does convex-setup-auth support?

convex-setup-auth covers Convex Auth plus Clerk, WorkOS AuthKit, Auth0, and custom JWT integrations. The skill wires each provider into Convex user tables, identity mapping, and protected function patterns.

When should developers skip convex-setup-auth?

convex-setup-auth targets Convex backends only. Skip it for non-Convex APIs, pure OAuth/OIDC reference reading, or auth debugging unrelated to Convex function access control.

Is Convex Setup Auth safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Backend & APIsbackendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.