Jordi Olle Logo
Back

Building with purpose 6.2: Retrieving the user from Clerk

Published on June 18, 2025

Building with purpose 6.2: Retrieving the user from Clerk

Having the long-lived token copied somewhere nearby, it's now time to retrieve the user from Clerk, but to do so, we need to make a few adjustments.

From our index.ts, we need to modify the dotenv import and use import "dotenv/config" instead. Make sure this import is before the Clerk imports. With this done, we can remove the dotenv.config(); and the second object we are passing to server.register() where we pass the clerkPlugin (we don’t need the keys now).

Next, go to Postman and paste the long-lived token into our Authorization tab (make sure you change the Auth Type to Bearer Token before pasting it).

We can now try the route, and if we did everything correctly, we should receive a 200 OK response and our user.

That's it for this part.

Salut, Jordi.

Check the repository HERE.

Did you like this article? Read the original post on Hashnode.