Home > Systems Design and Architecture 🔥 > Fundamentals of Systems Design > Cookie vs. Token Authentication
Some of the advantages of cookie-based authentication include:
- It is a fully automated process: the browser will take care of cookie handling, and it will automatically add the cookies for all the requests
- It makes your application stateful, which is useful in tracking and personalizing the state of a user
- Cookies prevent/reduce manipulation by client-side JavaScript
- Cookies are small in size and easy to store
- It can store additional data for user personalization, access control, etc.
However, there are also a few disadvantages of this type of authentication:
- It is vulnerable to Cross-site request forgery attacks - it often needs other security measures such as CSRF tokens for protection
- The cookie is sent on every request, even with the URLs that do not need authentication
- Cookies only work on a single domain unless you specially configure it
- For mobile apps, it is difficult to manage the cookies, so it is more suitable for web clients