Categories
JavaScript Answers

How to set JWT token expiry time to maximum in Node?

Spread the love

To set JWT token expiry time to maximum in Node, we call the sign method.

For instance, we write

const token = jwt.sign({ email_id: "123@gmail.com" }, "secret", {});

to call jwt.sign to create a token with the object as the data and the 'secret' secret.

We leave out the expiry time value to set the expiry time to the maximum value.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published.