Asp.Net Core Web API with JWT Authentication & Refresh Tokens using SQL Server + Identity Server

Code Hub • August 21, 2025
Video Thumbnail

About

Welcome to Code Hub! 🚀 At Code Hub, we turn complex programming into simple, easy-to-follow lessons. Whether you’re learning Flutter, .NET, Svelte, or exploring real-world projects, our tutorials help you build apps, solve problems, and level up your coding skills. Join other passionate learners who are already building amazing projects with us. Subscribe now and start your journey from ideas to execution – one line of code at a time. Topics We Cover: Mobile App Development Web Development API Development & Integrations Real-World Projects & Tips Tech Updates Code smarter. Build faster. Learn forever. 💻

Video Description

🔥 Want to build a secure ASP.NET Core Web API with JWT Authentication and Refresh Tokens? In this tutorial, I’ll show you step-by-step how to implement a real-world authentication system using SQL Server, Identity, and JSON Web Tokens (JWTs). ------------------------------------------------------------------------------------- Here’s what you’ll learn: ✅ Set up ASP.NET Core Web API with Entity Framework & SQL Server ✅ Implement JWT Authentication with Access Tokens ✅ Add Refresh Token functionality to keep users logged in securely ✅ Store, validate, and revoke refresh tokens in the database ✅ Apply Role-Based Authorization to protect your endpoints ✅ Test everything in Postman like a pro 💻 By the end of this video, you’ll have a production-ready authentication system you can use in any .NET project. ------------------------------------------------------------------------------------- Download Source Code: https://www.patreon.com/posts/asp-net-core-web-136985265 ------------------------------------------------------------------------------------- Chapters: - 00:00 Introduction 00:27 Create project & Import Required Packages 01:35 Create Models & Database 05:14 Create DTO's 06:51 Create Token Service Class 10:28 Create Role Controller 12:51 Create Auth Controller 20:00 Create Test Controller 21:02 Setup Program.cs File 23:16 Create Roles [Testing] 25:21 Create Users [Testing] 25:55 Assign Roles To Users [Testing] 26:43 Login & Generating Access Tokens [Testing] 29:02 Generation Access Tokens Using Refresh Token [Testing] 30:35 Revoking Refresh Tokens [Testing] ------------------------------------------------------------------------------------- Related Videos: 1. Custom Role Based Authentication In Asp.net Core MVC Application - Complete Tutorial: https://youtu.be/p6X-dDx6nQY 2. Create Custom Login, Registration, Email Verify And Forgot Password Pages In Asp.Net Core MVC App: https://youtu.be/hthzKj05w3w 3. Create Role Based User Management API Using Dynamic Policies In Asp.Net Core Web API: https://youtu.be/beIEysfQxGo 4. Create Role Based User Management App In Flutter With Asp.Net Core Web API as Backend From Scratch: https://youtu.be/Jdil0z11HG4 5. Create Wallpaper App In Flutter From Scratch Using Pexels API [Complete Tutorial]: https://youtu.be/c34fAl58NE0 6. Create Camera App From Scratch In Flutter [with Flash, Camera Switching, Multiple Images Functions]: https://youtu.be/j2xMGZ1XcMo 7. Connect Flutter With Asp.Net Core Web API To Run On Emulator & Real Device: https://youtu.be/PAY6TqIEVZI ------------------------------------------------------------------------------------- 📢 Stay Connected: 💖 Like this video if you found it helpful! 📣 Share your thoughts or questions in the comments below! 🚀 Share this video with your friends. ------------------------------------------------------------------------------------- Join WhatsApp Channel: https://whatsapp.com/channel/0029VaE0W6HA2pLH5dN39n36 Facebook Page Link: https://www.facebook.com/Free_Trained Facebook Group Link: https://www.facebook.com/groups/1746009532359857/ Please Subscribe Our YouTube Channel For More interesting Videos And Don't Forget To Share Our Channel With Your Friends. Note: *Please Turn Off Any Ad Blocker Software or add-on to support us. #aspnetcore #jwt #dotnet #webapi #authentication #refresh #token

You May Also Like

Essential ASP.NET Core Tools

AI-recommended products based on this video

Loading...
KINGRACK 4 Step Ladder, Sturdy Steel Step Stool with Tool Platform, Safe-Lock, Handrail, Anti-Slip Wide Pedals, Pass 800lbs Load Testing, Folding Portable Ladder for Multi-Purpose, Home Kitchen, Black Global Recycled Standard

KINGRACK 4 Step Ladder, Sturdy Steel Step Stool with Tool Platform, Safe-Lock, Handrail, Anti-Slip Wide Pedals, Pass 800lbs Load Testing, Folding Portable Ladder for Multi-Purpose, Home Kitchen, Black Global Recycled Standard

(1,607)
$113.99
50+ bought in past month
Loading...
Electric Razor for Men Cordless: Wet/Dry Rotary Shaver Waterproof - USB Fast Charging & Sensitive Skin Care - Pop up Trimmer & Precision Blades Vintage Black Upgraded

Electric Razor for Men Cordless: Wet/Dry Rotary Shaver Waterproof - USB Fast Charging & Sensitive Skin Care - Pop up Trimmer & Precision Blades Vintage Black Upgraded

(51)
$49.99
FREE delivery Wed, Dec 24
600+ bought in past month
Loading...
rategis Cordless Electric Razor for Men: 3-in-1 Shaver for Beard/Nose/Sideburns - IPX7 Waterproof Travel Kit - Turbo Speed & Precision Blades

rategis Cordless Electric Razor for Men: 3-in-1 Shaver for Beard/Nose/Sideburns - IPX7 Waterproof Travel Kit - Turbo Speed & Precision Blades

(11)
$29.99
Prime
1K+ bought in past month
Loading...
rategis Cordless Electric Razor for Men: 3-in-1 Shaver for Beard/Nose/Sideburns - IPX7 Waterproof Travel Kit - Turbo Speed & Precision Blades,Brilliant Black

rategis Cordless Electric Razor for Men: 3-in-1 Shaver for Beard/Nose/Sideburns - IPX7 Waterproof Travel Kit - Turbo Speed & Precision Blades,Brilliant Black

(77)
$29.99$26.99
FREE delivery Sat, Nov 22 on your first order
Loading...
rategist Cordless Electric Razor for Men: 3-in-1 Shaver for Beard/Nose/Sideburns - IPX7 Waterproof Travel Kit, Brilliant Black

rategist Cordless Electric Razor for Men: 3-in-1 Shaver for Beard/Nose/Sideburns - IPX7 Waterproof Travel Kit, Brilliant Black

(229)
$49.99
FREE delivery Tue, Jun 24
900+ bought in past month
Loading...
eXtremeRate ThumbsGear Interchangeable Thumbstick for Xbox Controller - Improve Comfort - Orange 3 Height Domed & Concave Grips Ergonomic Adjustable Joystick for Xbox Core, for Xbox One S/X/Elite

eXtremeRate ThumbsGear Interchangeable Thumbstick for Xbox Controller - Improve Comfort - Orange 3 Height Domed & Concave Grips Ergonomic Adjustable Joystick for Xbox Core, for Xbox One S/X/Elite

(680)
$19.99
FREE delivery Sun, Aug 24 on your first order
Loading...
eXtremeRate ThumbsGear Interchangeable Thumbstick for Xbox Controller - Improve Comfort - Chrome Gold 3 Height Domed & Concave Grips Ergonomic Adjustable Joystick for Xbox Core, for Xbox One S/X/Elite

eXtremeRate ThumbsGear Interchangeable Thumbstick for Xbox Controller - Improve Comfort - Chrome Gold 3 Height Domed & Concave Grips Ergonomic Adjustable Joystick for Xbox Core, for Xbox One S/X/Elite

(351)
$20.99
FREE delivery Sun, Aug 24 on your first order
Loading...
eXtremeRate EDGE Sticks Interchangeable Thumbsticks for Xbox Core Controller, Carmine Red Swappable Analog Stick Joystick for Xbox One S/X, Xbox Elite V1 Controller, for Nintendo Switch Pro Controller

eXtremeRate EDGE Sticks Interchangeable Thumbsticks for Xbox Core Controller, Carmine Red Swappable Analog Stick Joystick for Xbox One S/X, Xbox Elite V1 Controller, for Nintendo Switch Pro Controller

(23)
$23.99
FREE delivery Tue, Aug 26 on your first order
Loading...
eXtremeRate Metal Thumbsticks for Xbox Core Wireless Controller, Green Custom Concentric Circles Aluminum Alloy Analog Stick Joystick Buttons for Xbox One S/X/Elite, for Xbox Series X/S Controllers

eXtremeRate Metal Thumbsticks for Xbox Core Wireless Controller, Green Custom Concentric Circles Aluminum Alloy Analog Stick Joystick Buttons for Xbox One S/X/Elite, for Xbox Series X/S Controllers

(68)
$16.99
FREE delivery Sun, Aug 24 on your first order