DEV Community

Discussion on: Node.js Express Login example with MongoDB

Collapse
 
mlippert profile image
Mike Lippert • Edited

I saw the comments by Yasser-Massoud and Muco Rolle Tesor but neither explain why they think httpOnly cookies are a better storage option for a JWT.
As it is important to understand the reasoning behind your decision, I did some googling and found this really good explanation: stormpath.com/blog/where-to-store-...

Collapse
 
tassoman profile image
Tassoman

It's better to store JWT in the cookie storage httpOnly and secure.
So that you can scope it inside the domain, expire in a few minutes and transport by ssl