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.