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.

0
Subscribe to my newsletter

Read articles from Jordi Ollé Ballesté directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Jordi Ollé Ballesté
Jordi Ollé Ballesté

Always evolving Full-Stack Developer 👨🏼‍💻 Mountain addict 🗻