Summary
Keywords
Full Transcript
🔥 Access Source Code, PPT & Notes here for Free : https://www.thapatechnical.com/2024/11/introduction-to-nodejs.html 💸 Get All My YouTube Videos' Source Code for just ₹249! Grab Now - https://thapatechnical.shop/source-code ----------------------------------------------------------------------- In this video, we are implementing a secure token refresh mechanism to handle expired or missing access tokens using JWT & Sessions. If the access token is invalid or has expired but the refresh token is still valid, we will generate new access & refresh tokens and store them securely in cookies. 📺 Watch the complete Node.JS Playlist here :https://youtube.com/playlist?list=PLwGdqUZWnOp3KELplHtc-RnJ5xTUPqdgH&si=_ob8F88HYxCdspup You will learn: ✅ How access & refresh tokens work in authentication ✅ What happens when an access token expires ✅ Extracting tokens from cookies and verifying them ✅ Fetching session and user details from the database ✅ Generating a new access & refresh token dynamically ✅ Storing tokens securely in cookies ✅ Running & testing the authentication flow in a real app ✅ What happens to tokens when the user logs out ---------------------------------------------------------------- 🚀 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: Refreshing Access & Refresh Tokens 📍 1:50 - Step-by-Step Guide to Refreshing Tokens 📍 6:10 - What Happens When the Access Token Expires? (Theory) 📍 7:02 - Understanding Database Structure for Refresh Tokens 📍 8:15 - Get the Source Code for Free 📍 9:30 - Where Is the verifyAuthentication Function Used? 📍 10:40 - Extracting access_token and refresh_token from Cookies 📍 12:45 - Handling Cases When an Access Token Is Present 📍 14:25 - If the Access Token Is Missing or Invalid, Let’s Refresh It 📍 17:15 - Fetching the Session from the Database Using ID 📍 20:00 - Fetching the User from the Database Using ID 📍 22:00 - Generating a New Access & Refresh Token 📍 24:35 - Storing Both Tokens Securely in Cookies 📍 25:00 - Quick Recap of What We Did 📍 26:40 - Running the App & Testing the Refresh Token Flow 📍 29:00 - What Happens to Tokens When We Logout?
