Easy & Secure: Add Refresh token in .NET (C#) WebAPI with JWT Authentication

Опубликовано: 27 Октябрь 2024
на канале: Code with Saar
6,293
118

In this video, I am going to talk to you what, why, how and when to use a refresh token in .NET (C#) WebAPI application. It will support role change scenario.

🍔 Takeaways

Issue short lived access token and long lived refresh token;
Refresh token reduces chance to require user login;
Refresh token is easy to revoke for a user; access token is NOT.

For more videos like this:

💡Subscribe: https://www.youtube.com/c/CodewithSaa....

🧩 Resources

📺 Demo code:

https://github.com/xiaomi7732/JWTAuth...

💬 Discord server for Code w/ Saar:   / discord  

➡️ Reach me on twitter @CodeWithSaar. My home page: https://www.codewithsaar.net

☕ If you want to buy me a coffee: https://www.buymeacoffee.com/codewith... and thank you!

🔖 Chapters

00:00 Intro
01:00 What is refresh token
02:51 When is refresh token needed
06:27 Review codebase
07:40 Add expiration for access token
09:39 Append refresh token to authentication result
14:05 Add Refresh route
20:28 Demo the usage of the refresh token
22:25 Add a revoke route