[Solved] How to get clerk userId in a publicProcedure?

I need to get the authenticated user's id. I tried to use getAuth but I need to pass "req" as a parameter. Now the thing is, I don't have req in my publicProcedure. I only have input and ctx. Ctx only has prisma and input is just the input I passed to the query. Do you guys know how to get the authenticated userId???
4 Replies
whatplan
whatplan14mo ago
use the clerkClient
whatplan
whatplan14mo ago
Client | Clerk
The Client object tracks sessions, as well as the state of any sign in and sign up attempts.
Nemila
Nemila14mo ago
Thank you but I tried and I couldn't get it to work Instead I found the solution the clerk doc
Nemila
Nemila14mo ago
TRPC | Clerk
Learn how to integrate Clerk into your Next.js with TRPC