Difference between cookies, session and tokens

preview_player
Показать описание
What are cookies, sessions, and tokens? Most web servers use cookies to send the session-ID after you log in.
🔻 Click on SHOW MORE 🔻

So the server will store the session information in the database while you will only have the session id in a cookie, which is stored in the filesystem of your computer.

Next time you request another page, your browser will automatically send a cookie containing your sessionId, which the server will check to see if it is valid.

The session-ID is randomly generated and should be hard to guess. If you log out, the session will be deleted on the server, but also the server will instruct the browser to delete the cookie containing the session-ID.

An alternative to this is to store information on the client and sign it. In this scenario, anyone holding the signature can quickly check if the data was manipulated or not. One way to do this is to use JSON Web Tokens (JWT tokens).

Let's now assume that you want to install an app on your phone, which can help you with your finances and keep track of your spendings. What you don't want to do is to give your username and password to this app, which was not created by your bank. This is when access tokens are being used to grant access to your data.

Technologies mentioned in this video:

#cookies #sessions #tokens
--

⭐️ Additional explanation ⭐️

[1] In the example shown, the user transitioned from a not-logged-in state (one session id) to a logged-in state (new session id). This is why you see two cookies. Make sure you check the HTTP requests for the Set-Cookie and Cookie headers.

[2] While both the Cookie/Set-Cookie and Authorization are headers, a browser will always treat the Cookie/Set-Cookie differently.

If this was helpful and you want to support me create more videos like this one, please consider subscribing.

--

⭐️ Video contents ⭐️

⌨️ 00:00 - Login example with cookies
⌨️ 05:26 - Recap: cookies and sessions
⌨️ 06:06 - Token-based authentication
⌨️ 09:20 - Difference between tokens vs session cookie
⌨️ 11:00 - Conclusion

--

⭐️ 💬 I have a question. ⭐️

I do my best to answer all comments here on YouTube but I cannot make any guarantees.

Please do not email me or contact me on other channels as I might not be able to answer. Sorry!

--

⭐️ 💡 I have a video idea ⭐️

Do you want me to create a video on a specific topic? Just fill out the form below:

--

⭐️ 📩 Contact & Imprint ⭐️

👉 Follow me on Twitter:

👉 Follow me on Medium:

👉 Follow me on Facebook:

👉 Let's connect on LinkedIn:

Рекомендации по теме
Комментарии
Автор


P.S. Thanks for all your kind comments and sorry for the annoying background music!

vdespa
Автор

Had been confused for their difference for so long. Thank you for the clear explanation!!

chia-anyang
Автор

Excellent work man! I feel like this explanation was much easier to understand than reading the documentation. Also, I'm really digging the graphics and animations!

thehowerd
Автор

I started with your Agile courses, now I am learning Postman with you. You're an awesome trainer!

ioana
Автор

The clearest video about cookie imo.
Thanks a lot!

djeksrm
Автор

First video to help with the topic!! please KEEP DOING MORE ^_^

wqnjonz
Автор

Learning through virtual representations is the best way to remember concepts for a long time, Great work!

be_like_vishnoi
Автор

Thank you! This was the only short video example I could find on the use cases of tokens

jacobshade
Автор

I would pay anything to see more content like this. Thank you, u' the best bro.

deleted
Автор

Earlier i completed a tutorial of yours in Udemy on rest apis and it was also very well explained. This video is the first one of yours i'm watching in YouTube and it is so nice.. anybody can understand it. This video deserves a 1000 likes and comment!! Thank you very much!!

bholanathm
Автор

thanks a lot for this video. It was very concise, to the point and very easy to understand. Will definitely checkout your other videos as well. Thanks again

void
Автор

Simplified, clear and informative. Thanks for sharing.

azlanuza
Автор

Awesome explanation...put all the concepts/terminologies clearly on the table so that can easily differentiate between these terms.. subscribed immediately.... Kudos

Sandywf
Автор

Thank you for the detailed yet simple to understand explanation.

knightjaz
Автор

Thank you Valentin, currently some of this is clear now to me, thank your for uploading this kind of informative video in a concise manner.

SalakotPhilippines
Автор

I was confused so much on this topic . But after watching this i am thinking why so many youtubers made this topics so confusing expect you . The best explanation of cookies, Session and tokens.. Thank you so much.

__priyanshu__sharma____
Автор

Very easy to understand. good animation. best voice over.
Thx Valentin.

andronasef
Автор

Great Job Valentin! Very well explained and easy to learn! Thanks a lot!

drinks.a
Автор

Great channel, I've learned a lot. You're very clear and to the point.

ifaceTech
Автор

What a great video. Excellent work. Thank you so much. I'm going to watch this multiple times. I've liked and subscribed based on this video alone. . . Thank you.

malcolmlagares