Basic authentication: How to add in ASP.NET Core

preview_player
Показать описание
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💻

📖 Learn .NET and C# with our online courses 📖

► More information:

► 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
15:14 Set up in a controller
16:16 Test in Swagger
17:19 How to purchase the code sample

#oauth #authentication #dotnet
Рекомендации по теме
Комментарии
Автор

thank you so much, this video clear to understand how to do. i hope can add the basic auth to our old asp.net web api

pututik
Автор

Thank you very much for the video.
I just needed that!
Saved me quite some time.

DamageSoftware
Автор

Thanks a lot as we really need it for NET 8. Detailed clear explanation. Thanks

AlexUkrop
Автор

has been deprecated 2:19

Suggestions?

franciscoarena
Автор

how do you create class library for basic authentification?

TheShmrsh
Автор

With this method
When I’m execute my API with postman I have to set header to
Authorization Basic base64username&password

Right?

nicezii
Автор

Isn't the token API supposed to return a token?

venkatpasumarthi
Автор

1:16 its base64 not hash or am i wrong?

svens