Getting started
For AI agents: see llms.txt for the complete documentation index. Markdown versions are available by adding .md to a page URL or requesting Accept: text/markdown.
Every project using Convex Auth starts with these steps.
- Install Convex Auth
Add the Convex Auth package to your project.
- npm
- pnpm
- yarn
- bun
npm i @convex-dev/authpnpm add @convex-dev/authyarn add @convex-dev/authbun add @convex-dev/auth - Install the core component
Register the Convex Auth component in
convex/convex.config.ts. The guide of each sign-in method adds more components to this file.convex/convex.config.tsimport { defineApp } from "convex/server";import auth from "@convex-dev/auth/convex.config.js";const app = defineApp();app.use(auth);export default app; - Configure the authentication provider
Create
convex/auth.config.ts. This file tells your deployment to accept the access tokens of Convex Auth. Your deployment signs the access tokens with its own key, thus you do not have secrets to configure.convex/auth.config.tsimport type { AuthConfig } from "convex/server";import { convexAuthProvider } from "@convex-dev/auth/server";export default {providers: [convexAuthProvider()],} satisfies AuthConfig; - Set up Convex Auth
Create
convex/auth.ts, and export the functions of the core from it. The guide of each sign-in method adds its functions to this file.convex/auth.tsimport { components } from "./_generated/api";import { setupConvexAuth } from "@convex-dev/auth/server";const auth = setupConvexAuth({ component: components.auth });export const { signOut, refreshSession, isAuthenticated } = auth;
Install a sign-in method
Pick a sign-in method and follow its guide to wire it up: