Difference between cookies, session and tokens
ฝัง
- เผยแพร่เมื่อ 15 พ.ค. 2024
- 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:
JWT Tokens: jwt.io/
OAuth, OAuth2: oauth.net/
OpenId: openid.net/
#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.
👉 / @vdespa
--
⭐️ 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 TH-cam 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:
forms.gle/uWEzXFQ2viJtZtvZ7
--
⭐️ 📩 Contact & Imprint ⭐️
👉 Follow me on Twitter:
/ vdespa
👉 Follow me on Medium:
/ vdespa
👉 Follow me on Facebook:
/ valentin-despa-1130381...
👉 Let's connect on LinkedIn:
/ vdespa
vdespa.com/imprint
Liked this explainer video? Which topic should I cover next? Fill out this form: forms.gle/PTCM6RuWNHwZmhNNA
P.S. Thanks for all your kind comments and sorry for the annoying background music!
Had been confused for their difference for so long. Thank you for the clear explanation!!
Glad it helped!
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!
You are welcome. Thank you for leaving a comment.
I started with your Agile courses, now I am learning Postman with you. You're an awesome trainer!
Thanks Ioana 👍
The clearest video about cookie imo.
Thanks a lot!
You are welcome. Thank you for leaving a comment.
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 TH-cam and it is so nice.. anybody can understand it. This video deserves a 1000 likes and comment!! Thank you very much!!
You're very welcome!
@@vdespa can you give a link to the RestAPI tutorial
First video to help with the topic!! please KEEP DOING MORE ^_^
Thanks. Will do. Please submit your suggestions.
Learning through virtual representations is the best way to remember concepts for a long time, Great work!
Glad you think so! You are welcome. Thank you for leaving a comment.
Thank you! This was the only short video example I could find on the use cases of tokens
Glad to hear, Jacob. Thanks for your comment.
I’m preparing for an interview, and your videos help a lot! Thank you for your great work! 🤗
You bet! And good luck with your interview.
Did u get the job?
I love that you show the real tables and real encoded and decoded json.
I am glad that you liked it. You are welcome. Thank you for leaving a comment.
Simplified, clear and informative. Thanks for sharing.
I am glad that you liked it.
I would pay anything to see more content like this. Thank you, u' the best bro.
Glad you enjoyed! You are welcome. Thank you for leaving a comment.
Awesome explanation...put all the concepts/terminologies clearly on the table so that can easily differentiate between these terms.. subscribed immediately.... Kudos
Glad it was helpful! You are welcome. Thank you for leaving a comment.
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.
Glad you liked it! You are welcome. Thank you for leaving a comment.
Thank you for the detailed yet simple to understand explanation.
You're welcome. I am glad it helped
Gym membership analogy was spot on. Great works again!
Appreciate it! You are welcome. Thank you for leaving a comment.
Tomorrow is my exam but I still don't understand these cookie and session terms but now I can easily write everything with example...Great work man 🤩⭐️
Happy to help! You are welcome. Thank you for leaving a comment.
Same, Feel aiivgel chay lekin concept samjha na pebay..
Great Job Valentin! Very well explained and easy to learn! Thanks a lot!
Glad you liked it! You are welcome. Thank you for leaving a comment.
Your video is really among the best! It was so good that I was able to tolerate the unbearable background music (you don't need music, what you're saying is interesting enough). I agree with others that your channel is horribly underrated. Please keep up the good work!
Glad it was helpful! Thank you for letting me know about your thoughts.
Agreed. I don't understand why some"explainer" or tutorial videos do this.. Ever sit down in school for a hard subject and a teacher puts loud jingles on while talking? Of course not.
Very easy to understand. good animation. best voice over.
Thx Valentin.
You are welcome. Thank you for leaving a comment.
subscribed. just remove this music in the background please
Will do, thanks!
@@vdespadon’t do it, it’s fine
Don't do it just low the volume music make your video not boring
Great channel, I've learned a lot. You're very clear and to the point.
Glad that it helped. You are welcome. Thank you for leaving a comment.
Thank you for this explanation video. Clarifies the concept of tokens and sessions well!
I am glad that it was helpful!
This is really well put-together. Thanks a bunch!
You are welcome. Thank you for leaving a comment.
Such a very detail and informative video where you explain each important aspect of both session and token mechanism is a slow mode.
Glad you enjoyed it! You are welcome. Thank you for leaving a comment.
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.
Glad it was helpful! You are welcome. Thank you for leaving a comment.
Incredibly simple explanation. Thank you very much.
Glad you liked it You are welcome. Thank you for leaving a comment.
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.
You are welcome. Thank you for leaving a comment.
Superb explanation, really easy to understand and that too with real world examples. 👍
Glad it was helpful! You are welcome. Thank you for leaving a comment.
Very well conceptually explained !! Thanks a ton !
Glad you liked it! You are welcome. Thank you for leaving a comment.
Thank you for making it so simple to understand.
I am glad it was easy to understand. Thanks 👍
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
This is so clear and easy to understand. Thank you.
You're very welcome! I am glad that it helped.
The explanation was quite clear! Thank you
Glad it was helpful! You are welcome. Thank you for leaving a comment.
Thanks for the clear and concise explanations.. the analogies are well done!
Glad you enjoyed it! You are welcome. Thank you for leaving a comment.
One of the best explanations I found!
I am glad it was helpful! Thanks.
been trying for some days but in vain. Your video helped me to understand the concept thoroughly
You are welcome. Thank you for leaving a comment.
Wow, it's really easy to understand what you mean, and thanks for the analogy (that's very helpful).
Glad it was helpful!
Love how you have explained this, thank you.
Glad you enjoyed it! You are welcome. Thank you for leaving a comment.
Foarte bine explicat, Valentin!
Mulțumesc, Maria!
This is amazing! 👍👍Very easy to follow video with great illustrations.
Thanks for this video.
You're very welcome!
Thank you I was so confused by this. This video was exactly what is needed
Glad it was helpful! You are welcome. Thank you for leaving a comment.
This video was soooo amazing!! I understood everything now!! : )
Thankyou for making my life better : ))))
You are welcome!
this is goldmine of concepts for beginners.Keep creating more
Thanks you. Feel free to make suggestions.
Oh man, thank you very much! Just recently i was asked this question during the interview on QA Manual position and failed miserably. Now I am ready and armed for this fight)
Good luck next time. Thanks for your comment.
Thank you infinitely for the explanation! 😊
You are welcome. Thank you for leaving a comment.
Very informative & easy to digest. Thanks!
Glad it was helpful! You are welcome. Thank you for leaving a comment.
This one is helpful. Thank you so much! 🥰
Thanks for letting me know!
Your explanation is so clear!
You are welcome. Thank you for leaving a comment.
What a great explanation! Thank you!
Glad it was helpful! You are welcome. Thank you for leaving a comment.
I never comment on TH-cam, but god damn this was a great video for a dumb ass such as myself. Keep it up. People do not understand that to truly know a subject you must be able to break it down for the slow folks - thanks!
Thanks for your comment, I am glad this helped!
such a clear explanation, nice work!
Glad it was helpful! Thank you for leaving a comment.
very well explained. I was very confused about these simple terms.
Thanks 👍
Fantastic! I understand this now! Thanks for posting
You are welcome. Thank you for leaving a comment.
Wonderful, informative presentation! A lot to absorb in one go though, I'll have to watch the vid one or two more times 😃 Thank you.
You are welcome. Thank you for leaving a comment.
Well explained. Thanks for such a great content!
My pleasure! You are welcome. Thank you for leaving a comment.
Paldies par dalīšanos. Es izmantoju Morelogin, un tas aizsargā privātumu.
Excellent Information :) Most Underrated Channel deserves more Appreciation (Likes and Subscribers )
You are welcome. Thank you for leaving a comment.
Great explanation, thank you so much!
You are welcome. Thank you for leaving a comment.
Great video! Thanks so much for making this!
Glad it was helpful!
This is very well done, explained and helped me a lot. Thank you very much!
Glad it helped! You are welcome. Thank you for leaving a comment.
Excellent presentation.
But one point, i would like to highlight here which is "Cookie biased Session authentication" would not allow to access all the information.
For example:
In banking internet web portal, User-A has logged into by using his credentials. Once the user credentials are verified for User-A , application server assign cookie to the user-A and respond back to Brower client. For each request of this user-A, , application server should perform 2 checks -First, verify the cookie validity and second, the requested operation whether it is permitted to this user-A. If anyone of the above checks is failed, the application server should redirect to logic page to User-A.
very well understood, Thanks .. Keep posting more videos and we love to watch
Thank you, I will. You are welcome. Thank you for leaving a comment.
Wow! Very good explanation. Drawings helped a lot too. Very well done sir!
Glad that it helped! You are welcome. Thank you for leaving a comment.
incredible explanation man! great video!
Glad that it was helpful. Thank you for leaving a comment.
Fantastic video!!! Very helpful and informative.
Glad it was helpful! You are welcome. Thank you for leaving a comment.
Tahnk you for the info. Very good explanation..! Teaching is one of your talents for sure.
I appreciate that! You are welcome. Thank you for leaving a comment.
A good explanation, thank you! :)
Thanks. Consider subscribing
@@vdespa Not only, I already have your course about Postman on Udemy ;)
The best video I could found cleared my every doubt
You are welcome. Thank you for leaving a comment.
THANKS. I love this method of learning with infographics. Easy to learn
Great to hear! You are welcome. Thank you for leaving a comment.
Thank You - clear explanation and very useful
I am glad that it was helpful. You are welcome. Thank you for leaving a comment.
This is amazing, kudos to your hard work, thanks for helping :)
Happy to help! You are welcome. Thank you for leaving a comment.
This is so helpful! Thank you so much!
You're so welcome!
Very helpful!! Thank you so much for the video!!
Glad it was helpful! You are welcome. Thank you for leaving a comment.
Thanks. This is a wonderful video. Clear, with nice visuals
Glad you liked it! You are welcome. Thank you for leaving a comment.
very informative to start my software testing career. I like your teaching methodology
Great to hear! Best of luck to you in your career.
i LOVE this video. oh man. just delete all the other ones!!! being a little dramatic, lol, but I been hunting around for over an hour for a clear explanation with no random holes! TYSM for being so thorough and not leaving anything to assumption or the power of "et voila"! technology shouldn't feel like a magic trick. sheesh.
Thank you! Glad it helped.
Absolutely brilliant. Clearly explained
Glad it was helpful! Thank you for leaving a comment.
thank you. very good explained with the animations.. btw, I like the background music 😅
Glad you liked it! You are welcome. Thank you for leaving a comment.
Greate video, I am now clear with the difference between a token and a session and what is used when. Thank u
Glad it was helpful! You are welcome. Thank you for leaving a comment.
loved this! So simpley explained!
You are welcome. Thank you for leaving a comment.
Explanation is really good ❤
Glad to hear that, thanks!
This was very well explained thank you.
Glad you enjoyed it! You are welcome. Thank you for leaving a comment.
The gym membership analogy is funny because my gym literally said "You can use anything with a barcode!" So I used a work badge, now one badge gets me into both places
Good one 😂
Am really thankful to you.... It really helped me lot ... Great work 🥳
Glad to hear that You are welcome. Thank you for leaving a comment.
This was such a good tutorial, thank you !
Glad it was helpful! You are welcome. Thank you for leaving a comment.
Happy to follow you from now on for other exciting videos
Thanks a lot ....I confused a lot before watching This video
You are welcome. Thank you for leaving a comment.
You're great, explain very well!
Glad it was helpful! You are welcome. Thank you for leaving a comment.
Marvellous!! Very easy to understand.
Glad you think so! You are welcome. Thank you for leaving a comment.
Very Good explanation! Keep up the good work :)
Thanks a lot!
Very nice explanation, nice graphics, and background music, i enjoyed learning watching this video. Thanks!
Glad you enjoyed it! You are welcome. Thank you for leaving a comment.
fantastic video,, well-articulated and very clear and concise
You are welcome. Thank you for leaving a comment.
Brilliant explanation. Thank you!
You are welcome. Thank you for leaving a comment.
Superb. Great Explanation!! 👍👍
Glad you liked it
Excelllent information, and great graphics to explain the concepts
You are welcome. Thank you for leaving a comment.
great, easy to understand explanations!
Glad it was helpful! You are welcome. Thank you for leaving a comment.
Wow. Great explanation. Thank you
Glad it was helpful! You are welcome. Thank you for leaving a comment.
hey Sir ! Appreciate your video , it is clear easy understand the concept and different : )
You are most welcome! I am glad that it helped.
Easy to understand... Thank you
You are welcome. Thank you for leaving a comment.