So what are cookies, sessions, and tokens?

Most web servers use cookies to send the session-ID after you login.
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.

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.

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.

An alternative to this is to store information on the client and to 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 or 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:
OAuth, OAuth2:




👉 Want to learn more about Postman? Check my Postman online course.

Get it at a special price and help support this YouTube channel:



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

If you have a question, it is best to ask your question on the Postman User Group on Facebook or on the Postman Community (links below).

If you have purchased the Postman Online Course, please use the Q&A section or send me a message on Udemy.

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



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


// P L A Y L I S T S

▸ Learn Postman |

▸ Postman Crash Course |

▸ Postman Tips & Tricks |


// F R E E R E S O U R C E S

▸▸▸ DOWNLOAD the FREE Postman Quick Reference Guide

▸▸▸ JOIN the Postman User Group on Facebook

▸▸▸ The OFFICIAL Postman community forum


Nguồn: https://androidsvn.com

Xem thêm bài viết khác: https://androidsvn.com/lap-trinh-php/



27 thoughts on “Difference between cookies, session and tokens

  1. 👉 Want to learn more about Postman? Check my Postman online course.

  2. 2:13 You sayed that the session will be deleted after browser was closen

    When I open the website again how is web server use session id when session was deleted ?

  3. After login, I get a session id from server which is stored in a cookie; if somebody gets that cookie then would he be able to make requests on my behalf like a security vulnerability?

  4. Best tutorial for this topic, please share the which is best location for store Token at client side like localstorage, session storage or httpcookie only or else other, .. And how to impelement in asp.net core and SPA (Angular2/Vuejs/ReactJs). Awaiting your valuable inputs. Thank you for the video.

Leave a Reply

Your email address will not be published. Required fields are marked *