Session vs JWT Authentication: Secure Your App with JSON Web Tokens

Session vs JWT Authentication: Secure Your App with JSON Web Tokens

T
Thapa Technical
11 Video Views·Feb 24, 2025

🔒 Struggling to choose between Session-Based and JWT Authentication? In this video, we’ll break down both authentication methods, compare their advantages and disadvantages, and walk through a practical implementation of JWT authentication with secure cookie handling.

💸 Get All My YouTube Videos' Source Code for just ₹249! Grab Now - https://thapatechnical.shop/source-code

🔥 Access Source Code, PPT & Notes here for Free : https://github.com/thapatechnical/urlshortener

📺 Watch the complete Node.JS Playlist here :https://youtube.com/playlist?list=PLwGdqUZWnOp3KELplHtc-RnJ5xTUPqdgH&si=_ob8F88HYxCdspup

🚀 What You’ll Learn:
✅ How password hashing & verification work using Argon2
✅ What is Session-Based Authentication and how it works
✅ Pros & cons of Session-Based Authentication
✅ Understanding JWT Authentication and why it’s popular
✅ Pros & cons of JWT-based authentication
✅ How JWT tokens work (Structure & Implementation)
✅ Installing and generating JWT tokens with credentials
✅ Securely setting cookies with JWT for authentication

------------------------------------------------------------------------
🚀 Boost Your Skills with these Pre-Requisite Videos:

🔗 Best HTML Course - https://youtu.be/5ccq_nLHneE
🔗 Best CSS Course - https://youtu.be/MSICFljRcb4
🔗 JavaScript Basics Course Part 1 - https://youtu.be/13gLB6hDHR8
🔗 JavaScript Advanced Course Part 2 - https://youtu.be/YwsOCN8woA8

------------------------------------------------------------------------
💸 Build Your Own E-commerce Website for Free! - https://www.thapatechnical.com/2024/03/build-complete-ecommerce-website-using.html

------------------------------------------------------------------------
✌️ Join Us!

🚀 Become a Member: Unlock perks, free source code, and more Join Now : https://www.youtube.com/channel/UCwfaAHy4zQUb2APNOGXUCCA/join
📷 Connect on Instagram: https://www.instagram.com/thapatechnical
🗨️ Join Our Discord Server: Hang out with fellow programmers Discord Link: https://discord.gg/MdScmCsua6

------------------------------------------------------------------------

⌛TIMELINE⏳
0:00 - Introduction to password hashing & verification using Argon2
0:30 - Understanding session-based authentication
2:50 - Advantages & disadvantages of session-based authentication
5:00 - Introduction to JWT-based authentication
6:30 - Advantages & disadvantages of JWT authentication
7:10 - What we are going to implement in this video
8:45 - Introduction to JSON Web Tokens (JWT)
9:45 - Understanding the structure of a JWT token
10:30 - Installing JWT package and dependencies
11:40 - Calling the generateToken function with credentials
13:10 - Defining and explaining the JWT token
15:40 - Setting cookies with JWT for authentication
17:20 - Next video update & what’s coming next