Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Secure ASP.NET Core Web APIs with Custom Auth & JWT
New

Secure ASP.NET Core Web APIs with Custom Auth & JWT

Learn to build secure ASP.NET Core Web APIs using Custom Authentication and JWT from scratch
Created byMuhtar Qong
Last updated 6/2026
English

What you'll learn

  • Understand and implement a custom authentication scheme in ASP.NET Core Web API, including user registration, login workflows, and securing endpoints.
  • Explain the fundamentals of JSON Web Tokens (JWT), including token structure, signing, and how JWT-based authentication works in modern APIs.
  • Build and configure JWT authentication end-to-end, including settings, token service creation, and integration into the app pipeline.
  • Secure Web API endpoints using authentication and authorization techniques, applying both custom authentication and JWT-based role/claim-based authorization.

Course content

2 sections11 lectures3h 13m total length
  • Introduction2:03

    In this course, we’ve covered many fundamental concepts through practical, hands-on examples. Now it’s time to focus on API security.

    In ASP.NET Core Web APIs, there are multiple authentication options. For example, we can use the Microsoft identity platform or Windows authentication. In many cases, Visual Studio can scaffold much of the required setup for us, including the necessary code and database tables. We can also use external, token-based options such as JWT authentication.

    However, in this section, I’d like to introduce a custom authentication scheme. The goal is not to replace industry standards, but to help you understand what happens behind the scenes in a modern, secure, token-based authentication flow.

    In this section, we will build everything step-by-step:

    1. Create the required C# classes and configuration for a custom authentication scheme

    2. Use Entity Framework Core, run migrations, and generate the required database tables

    3. Build a user registration endpoint

    4. Build a login endpoint that validates passwords and issues an access token

    5. Use this custom scheme to protect our API endpoints with [Authorize]

  • Custom Authentication Flow6:44

    Custom authentication validates users with hashed passwords, issues a database-stored token, and protects APIs by validating that token on every request.

  • Creating a User Registration Endpoint27:46

    Creating a User Registration Endpoint.

  • Creating a Login Endpoint25:40

    Creating a Login Endpoint.

  • Custom Authentication Implementation and Protected Endpoints36:02

    Custom Authentication Implementation and Protected Endpoints.

Requirements

  • Intermediate knowledge of C# programming (classes, methods, basic OOP concepts).
  • Basic to intermediate experience with ASP.NET Core Web API (controllers, routing, and project structure).

Description

Learn to build secure ASP.NET Core Web APIs using Custom Authentication and JWT from scratch

In this course, you will learn how to secure ASP.NET Core Web APIs using two powerful authentication approaches: Custom Authentication Scheme and JSON Web Tokens (JWT).

We start by building a complete custom authentication system from scratch, including user registration, login, and protecting API endpoints. You will understand how authentication flows work internally and how to control access using a custom scheme.

Next, we move into JWT-based authentication, one of the most widely used standards for securing modern APIs. You will learn how JWT tokens are created, structured, signed, and validated. Step by step, you will implement a full JWT authentication system, including configuration setup, token service creation, dependency injection, and securing endpoints with authorization policies.

By the end of this course, you will have hands-on experience building secure, production-ready Web APIs using both custom authentication and JWT.

This course is designed to be practical and focused, helping you strengthen your backend development skills and confidently implement authentication in real-world ASP.NET Core projects. Perfect for real-world API development practice.

  1. Intermediate knowledge of C# programming (classes, methods, basic OOP concepts).

  2. Basic to intermediate experience with ASP.NET Core Web API (controllers, routing, and project).

Who this course is for:

  • Developers who want to secure ASP.NET Core Web APIs using real-world authentication techniques. Both for biginner and seasoned developers.
  • C# and ASP.NET Core developers looking to implement custom authentication and JWT in their projects.
  • Backend developers aiming to improve API security and authorization skills.