Jordi Olle Logo
Back

Building with purpose 6.1: Getting the long live token

Published on June 4, 2025

Building with purpose 6.1: Getting the long live token

Now that the user is created, we need to generate the long-lived token to continue with the backend and set aside the frontend for a while. To do this, we’ll go to our Clerk dashboard, select the Configure tab, and click on the JWT templates item.

Once here, select New template and use the Blank option. Now you’ll have to add a name and a token lifetime (315360000 is 10 years, in case you were wondering).

Hit save, and we’ll move to our frontend with the user already signed in. The next action is to open the console from the developer tools and paste in this line of code (replace testing-template with your template name):

await window.Clerk.session.getToken({ template: "testing-template" });

After hitting enter, you will receive the awaited long-lived token.

Make sure you copy it somewhere so we can use it for testing the backend now.

That's it for this part.

Salut, Jordi.

Check the repository HERE.

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