Stop using JSON Web Tokens. Use Cookies & Server Sessions instead
CoderOne
@coderoneAbout
Unlock the world of web development! From beginner-friendly coding tutorials to advanced tips, join us for a journey of turning ideas into interactive digital experiences. Subscribe now for hands-on learning, project walkthroughs, and staying ahead in the dynamic realm of coding. Let's code together and build something extraordinary! Join the developers-friendly newsletter: https://islemmaboud.com/join-newsletter Website: https://islemmaboud.com Github: https://github.com/ipenywis Twitter: https://x.com/ipenywis
Latest Posts
Video Description
JSON Web Tokens are a great stateless way to authenticate your users and remove the load from your servers and APIs, but JWT is not always secure and can take more than what they can offer us as developers! If you have been using JWTs to implement your authentication architecture, you need to watch the most general practices and security pitfalls you should avoid! ⭐ Timestamps ⭐ 00:00 Intro 00:45 JWT the Right Way! 03:27 How JWT and Auth work? 04:44 Example Project 1: LocalStorage JWT 10:34 Stealing JWT From LocalStorage 12:50 Quick Fix for LocalStorage JWT tokens 13:21 How to implement HTTP-Only cookies w/ JWT 16:17 Login in with HTTP-Only cookies 16:53 Say goodbye to XSS 18:02 Using Stateful Server Sessions 21:26 Invalidating JWT Tokens (Before Expiration) 💻 Source Code: Frontend App: https://github.com/ipenywis/jwt-best-practices Backend Server: https://github.com/ipenywis/jwt-best-practices-server 🧭 Turn Design into React Code | From prototype to Full website in no time https://youtu.be/0xhu_vgKZ8k 🧭 Watch Tutorial on Designing the website on Figma https://youtu.be/SB3rt-cQZas 🧭 Watch Create a Modern React Login/Register Form with smooth Animations https://youtu.be/-bll7l-BKQI 🧭 Debug React Apps Like a Pro | Master Debugging from Zero to Hero with Chrome DevTools https://youtu.be/_rnxOD9NKAs 🧭 Master React Like Pro w/ Redux, Typescript, and GraphQL | Beginner to Advanced in React https://youtu.be/M_Oes39FNuk 🧭 Learn Redux For Beginners | React Redux from Zero To Hero to build a real-world app https://youtu.be/_rnxOD9NKAs 🧭 Build Login/Register API Server w/ Authentication | JWT Express AUTH using Passport.JS and Sequelize https://youtu.be/VWEJ-GhjU4U 🧭 Introduction to GraphQL with Apollo and React https://youtu.be/eCO6MvvRhXk 🐦 Follow me on Twitter: https://twitter.com/ipenywis 💻 Github Profile: https://github.com/ipenywis Made with 💗 by Coderone
You May Also Like
iPhone 13 Pro Max Must-Haves
AI-recommended products based on this video

for Magsafe Car Mount【20 Strong Magnets 】Magnetic Phone Holder for Car Phone Holder Mount Dash【360°】Cell Phone Mount for Car Accessories,Car Mount for iPhone 16 Pro Max 15 14 13 12 Plus MagSafe Cases

Apple AirPods Pro 2 Wireless Earbuds, Bluetooth Headphones, Active Noise Cancellation, Transparency, Personalized Spatial Audio, High-Fidelity Sound, H2 Chip, USB-C Charging

3 in 1 Charging Station for iPhone, Wireless Charger for iPhone 16 15 14 13 12 11 X Pro Max & Apple Watch - Charging Stand Dock for AirPods Global Recycled Standard

3 in 1 Charging Station for iPhone, Wireless Charger for iPhone 16 15 14 13 12 11 X Pro Max & Apple Watch - Charging Stand Dock for AirPods (Blue) Global Recycled Standard

Wireless Charger for iPhone- 3 in 1 Charging Station for iPhone 16/15/14/13/12/Pro Max/Pro/Mini/Plus, Apple Watch 10/9/8/7/SE/6/5/4/3/2/1/Ultra2/Ultra, AirPods pro/2/3/4

OHLPRO Tablet Holder for Car, iPad Holder for Car Air Vent Mount, Universal Dashboard Windshield 2-in-1 Cradle TPU Suction Sticky Gel for iPad/iPad mini Samsung Galaxy Size 6"- 10.5" iPad Car Holder

Magnetic Car Mount Air Vent Cell Phone Holder, Universal Vehicle Dash Dashboard Ac Airvent Cellphone Magic Stand with Clip Hook, for iPhone 16 15 Samsung Lenovo Google etc

AINOPE Phone Holder for Car Vent 2025 Gravity Air Vent Car Phone Holder Mount for iPhone 17 Pro Max Vent Clip Hand Free Cell Phone Car Mount for iPhone Air 17 16 Pro Max Samsung S25 Car Accesorries
![Miracase Car Phone Mount, [2025 Upgraded Strong Military Grade Suction Cup] Long Arm Phone Holder for Car Dashboard Windshield Vent, Hands Free Cell Phone Holder Compatible with All Mobile Phones Global Recycled Standard](https://m.media-amazon.com/images/I/81oehGW5OLL._AC_UL960_FMwebp_QL65_.jpg)
Miracase Car Phone Mount, [2025 Upgraded Strong Military Grade Suction Cup] Long Arm Phone Holder for Car Dashboard Windshield Vent, Hands Free Cell Phone Holder Compatible with All Mobile Phones Global Recycled Standard
![VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung](https://m.media-amazon.com/images/I/71bHSP1cRkL._AC_UL960_FMwebp_QL65_.jpg)
VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung
![iPhone Charger Fast Charging [Apple MFi Certified] USB C to Lightning Cable 6FT USBC to Lightning Cable Nylon Braided Type C Cord for iPhone 14 13 12 11 Pro Max XR XS X 8 7 6 Plus SE, iPad](https://m.media-amazon.com/images/I/517jTqwo1nL._AC_UL960_FMwebp_QL65_.jpg)
iPhone Charger Fast Charging [Apple MFi Certified] USB C to Lightning Cable 6FT USBC to Lightning Cable Nylon Braided Type C Cord for iPhone 14 13 12 11 Pro Max XR XS X 8 7 6 Plus SE, iPad
![iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods](https://m.media-amazon.com/images/I/71xZOlUELbL._AC_UL960_FMwebp_QL65_.jpg)
iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod
![Spigen Case for Galaxy S25 Case, Rugged Armor MagFit [Fast Wireless Charging] Compatible with MagSafe - Black](https://m.media-amazon.com/images/I/81osE87mFrL._AC_UL960_FMwebp_QL65_.jpg)
Spigen Case for Galaxy S25 Case, Rugged Armor MagFit [Fast Wireless Charging] Compatible with MagSafe - Black
![Spigen Case for Galaxy S25 Case, Tough Armor (Ai) MagFit [Wireless Charging] Compatible with MagSafe - Black](https://m.media-amazon.com/images/I/71dL2NiwINL._AC_UL960_FMwebp_QL65_.jpg)
Spigen Case for Galaxy S25 Case, Tough Armor (Ai) MagFit [Wireless Charging] Compatible with MagSafe - Black

Spigen Case for iPhone 16 Case, Tough Armor Designed for Apple iPhone 16 - Black
![Spigen Case for iPhone 16 Pro Case, Tough Armor [MagFit] Compatible with MagSafe - Black](https://m.media-amazon.com/images/I/61rMnLID99L._AC_UL960_FMwebp_QL65_.jpg)
Spigen Case for iPhone 16 Pro Case, Tough Armor [MagFit] Compatible with MagSafe - Black
![[3+3 Pack] for Samsung Galaxy S26 Screen Protector, 9H Tempered Glass, Ultrasonic Fingerprint Compatible, HD Clear Case Friendly for Samsung S26 Tempered Glass Screen Protector 5G](https://m.media-amazon.com/images/I/71fBNpw7yNL._AC_UL960_QL65_.jpg)
[3+3 Pack] for Samsung Galaxy S26 Screen Protector, 9H Tempered Glass, Ultrasonic Fingerprint Compatible, HD Clear Case Friendly for Samsung S26 Tempered Glass Screen Protector 5G

LK 3 Pack for Top 9H+ Samsung Galaxy S26 Ultra Screen Protector, 12FT Military Grade Shatterproof Tempered Glass Screen Protector S26 Ultra with Easy Install Frame, 0 Bubble, Fingerprint Unlock
![[3 Pack] Screen Protector Tempered Glass for Nintendo Switch, iVoler Transparent HD Clear Anti-Scratch Screen Protector Compatible Nintendo Switch Global Recycled Standard](https://m.media-amazon.com/images/I/71ccbRRebHL._AC_UL960_FMwebp_QL65_.jpg)
[3 Pack] Screen Protector Tempered Glass for Nintendo Switch, iVoler Transparent HD Clear Anti-Scratch Screen Protector Compatible Nintendo Switch Global Recycled Standard
![ivoler 3-in-1 Case Designed for iPhone 17 6.3'' 2025 with 2 Pack Tempered Glass Screen Protector, [Military Grade Drop Protection] Hard Back Slim Shockproof Phone Cover, Anti-Scratch, Clear](https://m.media-amazon.com/images/I/81sXzfngx6L._AC_UL960_FMwebp_QL65_.jpg)
ivoler 3-in-1 Case Designed for iPhone 17 6.3'' 2025 with 2 Pack Tempered Glass Screen Protector, [Military Grade Drop Protection] Hard Back Slim Shockproof Phone Cover, Anti-Scratch, Clear
![Anker USB C Cable, [2-Pack, 6 ft] Type C Charger Premium Nylon USB Cable, USB A to Type C Charging Cable Fast Charge for Samsung Galaxy S10 S10+ / Note 8, LG V20 and Other USB C Charger (Black)](https://m.media-amazon.com/images/I/71N7xhCJnoL._AC_UL960_FMwebp_QL65_.jpg)


















