Thursday, 19 November 2026
Shola JegedeAuthentication · Convex component
@sholajegede/kinde-sync
A kinde sync component for Convex.
npm install @sholajegede/kinde-syncDownloads
Download history
Build this
Build with @sholajegede/kinde-sync
- 1
Installation
shnpm install @sholajegede/kinde-syncAdd the component to your
convex/convex.config.ts:tsimport { defineApp } from "convex/server"; import kindeSync from "@sholajegede/kinde-sync/convex.config.js"; const app = defineApp(); app.use(kindeSync); export default app; - 2
Setup
1. Mount the webhook handler in
convex/http.ts:tsimport { httpRouter } from "convex/server"; import { components } from "./_generated/api.js"; import { KindeSync } from "@sholajegede/kinde-sync"; const kindeSync = new KindeSync(components.kindeSync, { KINDE_ISSUER_URL: process.env.KINDE_ISSUER_URL!, }); const http = httpRouter(); http.route({ path: "/webhooks/kinde", method: "POST", handler: kindeSync.webhookHandler, }); export default http;2. Set your Convex environment variables:
shnpx convex env set KINDE_ISSUER_URL https://yourapp.kinde.com npx convex env set KINDE_CLIENT_ID your_client_id npx convex env set KINDE_CLIENT_SECRET your_client_secret3. Configure Kinde auth for
ctx.auth:This component handles webhook sync only. To enable
ctx.authin your Convex functions, createconvex/auth.config.ts:tsconst authConfig = { providers: [ { domain: process.env.KINDE_ISSUER_URL, applicationID: process.env.KINDE_CLIENT_ID, }, ], }; export default authConfig;4. Register the webhook in your Kinde dashboard:
- Go to your Kinde dashboard → Settings → Webhooks
- Click Add webhook
- Give it a name e.g.
Convex user sync - In the Endpoint URL field, enter your Convex HTTP actions URL:
codehttps://<your-deployment>.convex.site/webhooks/kindeYou can find your Convex site URL by running
npx convex devand looking forVITE_CONVEX_SITE_URLin your.env.local, or on the under your deployment settings. 5. Under Event triggers, select:user.createduser.updateduser.deleted
- Click Save
To verify it's working, create a user in your Kinde dashboard and check your Convex dashboard logs — you should see the webhook fire and the user appear in your
kindeUserstable instantly. - 3
Usage
Query synced users reactively from your Convex functions:
tsimport { query } from "./_generated/server.js"; import { components } from "./_generated/api.js"; import { v } from "convex/values"; export const getUser = query({ args: { kindeId: v.string() }, handler: async (ctx, args) => { return await ctx.runQuery(components.kindeSync.lib.getUser, { kindeId: args.kindeId, }); }, }); export const listUsers = query({ args: {}, handler: async (ctx) => { return await ctx.runQuery(components.kindeSync.lib.listUsers, {}); }, });tsx// React const user = useQuery(api.myFunctions.getUser, { kindeId: "kp_..." }); const users = useQuery(api.myFunctions.listUsers, {});