Basic authentication: How to add in ASP.NET Core

Опубликовано: 22 Октябрь 2024
на канале: Round The Code
13,153
153

Basic authentication is used in a HTTP request by adding a Base64 encoded username and password to the Authorization header.

It is used in OAuth as part of the client credentials flow for requesting an access token in the form of a Bearer token.

This .NET tutorial will show you what Basic authentication is, and how to format the username and password.

Afterwards, we'll add this security to an ASP.NET Core Web API by creating an authentication handler which handles the authentication of the client.

Finally, we'll add it to a controller and test it using Swagger.

💻 Download the code sample for this tutorial💻
https://www.roundthecode.com/dotnet-c...

📖 Learn .NET and C# with our online courses 📖
https://www.roundthecode.com/dotnet-c...

► More information:
https://www.roundthecode.com/dotnet-t...

► Chapters
0:00 Coming up...
0:20 Learn with .NET online courses
0:30 What is Basic authentication?
1:22 Basic Authentication in OAuth
2:00 NuGet packages
2:32 Authorize attribute
3:50 Client identity
4:59 Authentication handler
12:25 Program.cs configuration
15:14 Set up in a controller
16:16 Test in Swagger
17:19 How to purchase the code sample

#oauth #authentication #dotnet