ASP.NET Web API Token Authentication Guide
Learn how to implement token-based authentication in ASP.NET Web API to secure your applications effectively 🔐.

freeCodeCamp.org
21.0K views • Sep 18, 2025

About this video
When it comes to securing ASP.NET applications, authentication and authorization play key roles. Authentication verifies a user’s identity by checking their credentials, while authorization verifies a user’s roles. This video provides an overview of token-based authentication, contrasting it with cookie-based methods. Learn how tokens and refresh tokens function, why token-based systems offer enhanced security with shorter expiration times, and the process of generating new tokens. This course is perfect for understanding secure data access in web applications.
✏️ Course from @DotNetHow
💻 Code
- Beginning: https://github.com/etrupja/securing-aspnet-apps
- Final: https://github.com/etrupja/securing-aspnet-apps-final
Learn more from Ervis and get coupons for his other courses: https://dotnethow.net/freecodecamp
❤️ Support for this channel comes from our friends at Scrimba – the coding platform that's reinvented interactive learning: https://scrimba.com/freecodecamp
⭐️ Chapters ⭐️
- 0:00:00 Introduction
- 0:02:07 Authentication vs Authorization
- 0:04:34 Traditional vs Token-based Authentication
- 0:14:10 Adding Identity tables with EFCore
- 0:21:55 Configuring Authentication in Startup.cs
- 0:33:07 Setting up Authentication Controller
- 0:37:54 Registering a new user
- 0:47:36 Generating an access and a refresh token
- 1:02:38 Logging in an existing user
- 1:14:10 Get access token using the refresh token
- 1:41:41 Adding role based authentication
- 2:02:55 Thank you
🎉 Thanks to our Champion and Sponsor supporters:
👾 Drake Milly
👾 Ulises Moralez
👾 Goddard Tan
👾 David MG
👾 Matthew Springman
👾 Claudio
👾 Oscar R.
👾 jedi-or-sith
👾 Nattira Maneerat
👾 Justin Hual
--
Learn to code for free and get a developer job: https://www.freecodecamp.org
Read hundreds of articles on programming: https://freecodecamp.org/news
✏️ Course from @DotNetHow
💻 Code
- Beginning: https://github.com/etrupja/securing-aspnet-apps
- Final: https://github.com/etrupja/securing-aspnet-apps-final
Learn more from Ervis and get coupons for his other courses: https://dotnethow.net/freecodecamp
❤️ Support for this channel comes from our friends at Scrimba – the coding platform that's reinvented interactive learning: https://scrimba.com/freecodecamp
⭐️ Chapters ⭐️
- 0:00:00 Introduction
- 0:02:07 Authentication vs Authorization
- 0:04:34 Traditional vs Token-based Authentication
- 0:14:10 Adding Identity tables with EFCore
- 0:21:55 Configuring Authentication in Startup.cs
- 0:33:07 Setting up Authentication Controller
- 0:37:54 Registering a new user
- 0:47:36 Generating an access and a refresh token
- 1:02:38 Logging in an existing user
- 1:14:10 Get access token using the refresh token
- 1:41:41 Adding role based authentication
- 2:02:55 Thank you
🎉 Thanks to our Champion and Sponsor supporters:
👾 Drake Milly
👾 Ulises Moralez
👾 Goddard Tan
👾 David MG
👾 Matthew Springman
👾 Claudio
👾 Oscar R.
👾 jedi-or-sith
👾 Nattira Maneerat
👾 Justin Hual
--
Learn to code for free and get a developer job: https://www.freecodecamp.org
Read hundreds of articles on programming: https://freecodecamp.org/news
Video Information
Views
21.0K
Likes
711
Duration
02:04:16
Published
Sep 18, 2025
User Reviews
4.6
(4) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.