KinKon
KinKon•12mo ago

What is the right approach when updating the user object for an app that integrates Clerk for auth?

Hi everyone, I am building a credit based payment system for a convex app that uses Clerk for authentication. I am considering an implementation where I import updateUser from clerk-sdk-node and call it inside an action. I am wondering if there's a better way where I can update the user object using Convex. I wanted to avoid storing users in the database because I'm not convinced it is necessary for my use case. I'm also trying to figure out where I update my JWT template's Claims config
9 Replies
ian
ian•12mo ago
https://dashboard.clerk.com/apps/app_2T55WJm6qAKTQgzvzOtJvgB3eIe/instances/<instance name>/jwt-templates
No description
ian
ian•12mo ago
To see some user syncing to convex (if you decide to go that route): https://www.convex.dev/templates/clerk It also has some code around interacting with Clerk that can be helpful
Templates
The backend application platform with everything you need to build your product.
ian
ian•12mo ago
generally if you have the API key, you should be able to adjust Clerk but you might have to schedule an action to do it if you're in a mutation, since it requires a fetch / http request
KinKon
KinKonOP•12mo ago
Thank you for this Ian
Pietro
Pietro•12mo ago
Did you manage to pass custom claims ? I'm trying to add org_id to the claim but it does not seem to reach convex for some reason...
Michal Srb
Michal Srb•12mo ago
You need to use one of the valid OpenID claims, like "gender" "gender": "{{user.org_id}}"
Pietro
Pietro•12mo ago
🤯 thanks
Michal Srb
Michal Srb•5mo ago
Custom claims are now supported with convex@1.14.0
KinKon
KinKonOP•5mo ago
Thanks!

Did you find this page helpful?