OrganizationSwitcher from clerk not propogating org_id to convex getUserIdentity call
Perhaps I'm misunderstanding this technology, but I thought that you could use the OrganizationSwitcher component in clerk (assuming the org_id claim is set up in the jwt settings) to "tell" the user called from the getUserIdentity call in convex which org it is on (https://clerk.com/docs/components/organization/organization-switcher). That way, I don't have to deal with messy / arbitrary passing of orgIds & userIds from the front-end. Is there actually a correct way to do this?
4 Replies
or, if it doesn't work that way, then what's the point of the org_id claim at all?
maybe chat about this in #clerk to maximize eyes on it for people who know things about convex + clerk together?
ty
There's a few steps, sounds like you already have 1 & 2 done:
1. Set up a custom claim in the JWT Token interface in Clerk
2. Call
auth.getUserIdentity
to get the identity with a bunch of info from the "standard" claims
3. Access the custom claim on that same identity object. it will be typed as unknown
.
See https://news.convex.dev/announcing-convex-1-14-3/Convex News
Announcing Convex 1.14
Convex Auth for Next.js server side auth. We made some changes to make ConvexReactClient to enable Convex Auth for Next.js server side authentication.