Cookies vs Sessions vs Tokens
Published in
5 min readSep 27, 2020
Are you new to web-development, feeling confused with different Web Storage elements?
If yes, then you are at the right place This article will give you a brief explanation about sessions, cookies and tokens using its authentication techniques.
There are two different authentication techniques namely
- Cookie/Session-based Authentication
- Token-based authentication
What are cookies and sessions?
In simple words, Cookies and Sessions are files used to store information.
How do they differ
- Cookies are text files stored only on the client-side machine, where sessions create a file in a temporary directory on the server to store variables. Variables inside sessions help us to track user activities.
- Cookies get stored in the browser where sessions are not.
- Cookies can keep the information until it gets deleted where sessions get destroyed whenever the user tries to close a browser. Sessions will end by the server over a predetermined period, commonly 30 minutes duration.
- Variables defined inside a cookie helps the user from providing credentials for authentication every time. Variables inside a session help to track…