Access Clerk Organization in Query
I am authenticating users in my app via Clerk and can easily query for Clerk userId when making requests via ctx.auth. However I want to link an entity in my DB to Clerk Organizations and I don't have that information readily available in the Convex environment/context.
Is there a recommended approach to this from within Convex? The way I am thinking now is either fetching via Clerk in the frontend and passing it to the query each time or duplicating all of the Clerk data in Convex, but I'm not too keen on that.
3 Replies
Hey Luke, you have two options:
1. Use webhooks, like in this template: https://www.convex.dev/templates/clerk
2. Use an unused JWT field, like "gender", to pass the orgId through the JWT to ctx.auth.getUserIdentity()
Templates
The backend application platform with everything you need to build your product.
OK thanks for getting back to me, I will look into it
The webhook approach seems to have worked for me, thanks
Custom claims are now supported with
convex@1.14.0