Authenticate your users with Clerk
app/api/auth/webhook.ts
for the implementation.
When a user signs up or updates their profile in Clerk, the webhook will trigger and update your database accordingly, ensuring your user data stays in sync.
We need to make sure we create these webhooks in Clerk (both for testing locally and in production)
config.auth.enabled
to true
in config.ts
Configure
-> Webhooks
-> + Add Endpoint
b. Set the Endpoint URL
to [your-ngrok-url]/api/auth/webhook
c. Set the Events
to user.created
and user.updated
Users
tab) and a new record created in your users
table in Supabase ✅
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
CLERK_SECRET_KEY
Configure
-> Webhooks
-> + Add Endpoint
Endpoint URL
to https://[your-production-domain]/api/auth/webhook
Events
to user.created
and user.updated