Refreshing Access Token When It Expires (Session + JWT)
๐ฅ 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?
Download
0 formatsNo download links available.