#Convex Auth + Clerk

5 messages · Page 1 of 1 (latest)

green oxide
#

Is it possible to use convex Auth and auth tables with Clerk? I have a setup but when I sign in, no user is created in users table

oak gardenBOT
#

Hi @green oxide. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Convex Auth and Clerk are two separate authentication systems. If you are using Clerk for authentication, Convex does not automatically create user records in your Convex database (such as a users table) when a user signs in with Clerk. To have users appear in your users table, you need to set up a webhook in Clerk that notifies your Convex backend whenever a user signs up, updates, or deletes their account.

Here’s how you can achieve this:

  1. Set up Clerk webhooks:
    In the Clerk dashboard, go to Webhooks and add an endpoint pointing to your Convex deployment, e.g., <https://<your-deployment>.convex.site/clerk-users-webhook.> Configure it to listen for user events.
    After saving, copy the signing secret and set it as the CLERK_WEBHOOK_SECRET environment variable in your Convex dashboard.

  2. Handle webhook events in Convex:
    Implement a Convex HTTP endpoint to process incoming webhook events and create or update user records in your users table accordingly.

This approach ensures that every time a user is created in Clerk, a corresponding user record is created in your Convex database. Without this webhook integration, signing in with Clerk alone will not populate your users table in Convex automatically.

For more details and example code, see the official Convex documentation: Storing Users in the Convex Database – Set up webhooks and related Discord support threads where this is the recommended solution issue with creating users in convex connected with clerk.

#

Summary:
You cannot use Convex Auth tables directly with Clerk for automatic user creation. You must set up Clerk webhooks to sync user data into your Convex users table.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@green oxide Kapa.ai is still learning and improving, please let me know how I did by reacting below.