Kinde and edge worker services
Integrations
Bring real-time interactivity to your app with Convex, a powerful Backend-as-a-Service designed for dynamic React experiences.
Now, with Kinde webhooks, you can seamlessly sync user data from Kinde into your Convex database. This allows you to authenticate queries and mutations in Convex using access tokens generated by Kinde Auth.
Convex and Kinde work great together—this guide shows you how to connect them using webhooks so that your data stays in sync and your app stays secure.
Sign in to Kinde and select Add application.
In the dialog that opens, enter a name for the application (e.g., Kinde & Convex).
Choose Front-end and mobile as the application type, and select Save.
On the Quickstart page, select React and then select Save.
Select Set for both the Set callback URL, and Set logout URL.
Go to Authentication in the menu and select the Social connections you want to enable for your application (e.g., Google) and select Save.
From the Kinde home page, select Settings > APIs > Add API.
Type a name for the API (e.g., Convex)
Enter convex in the Audience field and select Save. This will enable the Convex backend to connect with your Kinde application.
From the Kinde home screen, select View details on your Convex application.
Go to APIs, you will see the Convex API you created earlier.
Select the three dots next to your Convex API and select Authorize application.
This will add convex into your Kinde JSON web token inside the aud field. It will allow convex to authorize a user using Kinde.
Clone or download the Kinde Convex Auth starter kit from GitHub using the following bash command:
This will generate a starter React Convex project with sample schema and route files included.
git clone https://github.com/tamalchowdhury/kinde-convex-auth.gitChange into the project directory:
cd kinde-convex-authInstall the project dependencies:
npm installCreate a .env file with the bash command:
touch .envOpen the .env file with your preferred code editor, and enter the variables found on Kinde > Kinde & Convex (your application) > Quick Start page.
Run the following command in your terminal. This will prompt you to log into your Convex account and walk you through setting up the project.
npx convex devIf you see an env variable error, it means you need to add your Kinde domain as the VITE_KINDE_DOMAIN in Convex.
Go to your Convex dashboard > Project > Settings > Environment Variables.
Set the VITE_KINDE_DOMAIN using the credentials from your Kinde Quick start page.
After the set up is complete, you should see green checkmarks in your terminal. Keep this Convex development running in the background to continue working with your project locally.
Your Convex project creates a custom endpoint under the /kinde-users-webhook route. If you open the /convex/http.ts file, you can see a new route definition for your Convex backend.
This endpoint will be listening for an incoming POST request from Kinde.
Go to your Convex dashboard > Project > Settings > URL & Deploy Key.
Select Show development credentials and copy the HTTP Actions URL.
In Kinde Home, go to Settings > Webhooks.
Select Add webhook.
Enter the webhook Name and description
Add the Endpoint URL. This is the HTTP Actions URL you copied in Convex: https://your_convex_subdomain.convex.site/kinde-users-webhook
Scroll down and select Add event.
Select all the user-specific events your application will listen for, and select Save.
Select Save on the webhook creation page to finish creating the webhook.
Open a new terminal window, but keep the Convex dev server running in the first one.
Enter the following command to run the Vite project.
npm startGo to http://localhost:3000 and sign in or create a new account.
Each time a new user signs up or signs in to your application:
upsertFromKinde handler in the /convex/users.ts file.You can find it in Convex, in the Convex dashboard > Data > users table.
Enter a task and select send. You will see the task show up in your application.
send handler in /convex/tasks.ts file.get handler of /convex/tasks.ts using the useQuery hook in /src/components/Tasks.tsx file.This happens in real-time thanks to Convex sync.
You can see the tasks in Convex Dashboard > Database > tasks table.
With webhooks in place, your Kinde user data is now automatically synced to your Convex database. This gives your application fast, secure access to user information while avoiding common performance issues like n+1 queries. It also ensures your UI stays responsive to real-time data updates.
Webhooks offer a flexible way to extend Kinde’s authentication and user management into your backend workflows, so you can work with the tools you already use while keeping everything connected.
Follow best practices, test your integration carefully, keep your dependencies up to date, and monitor for any security advisories to ensure everything runs smoothly.
If you need help, reach out to us at support@kinde.com. You can also join the Kinde community on Slack or Discord to connect with the team and others building with Kinde.