Vlad
Vlad8mo ago

How to get orgId from Clerk in Convex?

I updated JWT template to include orgId, however const identity = await ctx.auth.getUserIdentity() still returns this:
[CONVEX Q(runs:getRecentRuns)] [LOG] 'identity' {
tokenIdentifier: 'https://adjusted-cowbird-51.clerk.accounts.dev|user_2ihkVxcSCfujFgFa3yGBbx9jr05',
issuer: 'https://adjusted-cowbird-51.clerk.accounts.dev',
subject: 'user_2ihkVxcSCfujFgFa3yGBbx9jr05',
name: 'Bakhteev Vladislav',
givenName: 'Bakhteev',
familyName: 'Vladislav',
nickname: 'vbakhteev',
pictureUrl: 'https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvb2F1dGhfZ2l0aHViL2ltZ18yaWhrVnUzR3hBRkl1RnR1N2FKMHFmaTB1ZmYifQ',
email: 'email@email.email',
emailVerified: true,
updatedAt: '2024-07-03T05:21:28+00:00'
}
[CONVEX Q(runs:getRecentRuns)] [LOG] 'identity' {
tokenIdentifier: 'https://adjusted-cowbird-51.clerk.accounts.dev|user_2ihkVxcSCfujFgFa3yGBbx9jr05',
issuer: 'https://adjusted-cowbird-51.clerk.accounts.dev',
subject: 'user_2ihkVxcSCfujFgFa3yGBbx9jr05',
name: 'Bakhteev Vladislav',
givenName: 'Bakhteev',
familyName: 'Vladislav',
nickname: 'vbakhteev',
pictureUrl: 'https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvb2F1dGhfZ2l0aHViL2ltZ18yaWhrVnUzR3hBRkl1RnR1N2FKMHFmaTB1ZmYifQ',
email: 'email@email.email',
emailVerified: true,
updatedAt: '2024-07-03T05:21:28+00:00'
}
No description
4 Replies
ampp
ampp8mo ago
Im not exactly sure, but i think i didn't do that because its not in the "JWT standard" template. I read others trying to send it in on like the country field or something. I've done it with webhooks and through the browser only.
Vlad
VladOP8mo ago
That works, thanks! @ampp
ballingt
ballingt8mo ago
These are the standard fields, you can repurpose many of them for other information if you need to do that: https://github.com/get-convex/convex-js/blob/main/src/server/authentication.ts#L27-L47
Michal Srb
Michal Srb8mo ago
Docs: https://docs.convex.dev/auth/functions-auth#clerk-claims-configuration (they could be more explicit about this case as it is a common request)
Auth in Functions | Convex Developer Hub
Within a Convex function, you can access information

Did you find this page helpful?