DEV Community

Stanley
Stanley

Posted on • Updated on

Sending Jwt's using cookies in NodeJs Explained

Sending JWTs (Json web tokens) using cookies in Node.js is like giving a special pass to someone after they've logged into a website. This pass, the JWT, is like a digital ticket that proves they're allowed to access certain parts of the website.

Imagine this pass is put inside a cookie, just like a tasty treat. So, when you visit the website, your browser automatically carries this cookie (with the pass inside) back and forth to the website with each request you make.

The website checks this pass to see if it's valid and not expired. If everything looks good, it lets you in. If not, it says, "Sorry, you can't come in."

This way, you don't have to enter your username and password every time you click on something on the website. It's a convenient and secure way to prove who you are without constantly typing in your credentials.

Top comments (0)