I was writing an awesome stuff with Express today and I ran into an error, after solving it (thanks to some wonderful geeks on Stackoverflow) I t...
For further actions, you may consider blocking this person and/or reporting abuse
To whomever might read this:
DO NOT use string interpolation
This will set your secret to "undefined" WHENEVER process.env.ANY_VARIABLE is
undefinedeither by a typo or by a configuration issue. The actual solution is to addAs early as possible in your application so your environment variables are initialized. This would tipically be on index.js|ts, main.js|ts or server.js|ts, depending on your app. Go ahead and console log your JwtService
and see how if you dont add those 2 lines the secret will not be the one on the .env file.
Again, using string interpolation will just prevent the app from throwing an error by setting a different secret ("undefined") which would allow anyone to sign tokens and get unwarranted access to your app and you user's accounts.
Thanks for pointing this out!
What a legend
Thank you, it helped me a lot!!
Wow! I'm glad to hear this.
Btw, I just followed you on GitHub @brunahirano . Nice repos you have on there!
Yea man! This saved me. Thank you
You're welcome. I'm happy you find it useful.
if i'm getting this error on production environment? i mean locally works fine but i have my project deployed on aws and when i do a request to my endpoint, I'm getting the error
This issue is so strange. But thank you for the solution.
I'm glad I was able to help
WOW, I can't thank you enough
You're welcome.