When I run my server,I suffered following errors.
Error: Config validation error: "JWT_SECRET" is required. "JWT_EXPIRATION_TIME" is required
Therefore I must set JWT secret key and so on.
I'd like to know how to set JWT_SECRET
.But I couldn't figure out how to generate and set them.
I set.env
file,I must configure some of variables in them.
my.env
file is like following.
.env
JWT_SECRET=
JWT_EXPIRATION_TIME=
If someone know good way to generate SECRET
please let me know.
Thanks
As mentioned by @Arya and @JaromandaX, you have to type something after JWT_SECRET
something like this JWT_SECRET=yourfavoritecolor
and JWT_EXPIRATION_TIME=3600
. You can call them in your code with process.env.JWT_SECRET
and process.env.JWT_EXPIRATION_TIME
.
Check this article on JWT-Right way of implementing JWT