JWT authentication: How to add in ASP.NET Core

Published: 28 April 2023
on channel: Round The Code
6,380
78

JWT stands for JSON Web Token and holds payload data that asserts a number of claims.

A JWT can be used for security as part of the Client Credentials grant type in the OAuth 2.0 Framework. This flow involves authenticating a client using Basic authentication, then generating an access token that is then added as a Bearer token to the Authorization header of a HTTP request.

In this video, we'll use an ASP.NET Core Web API and C# code to generate an access token for JWT authentication. This will include adding a number of claims to the token such as the issuer, audience and the expiry. In-addition, we'll show you how to add a signing key to the token which can be used as a secret and how to validate it. When the token is generated we'll use Swagger to add the Bearer token to an HTTP request to test it.

Finally, we'll show you how to decode a JWT and how we can get the fields from the payload data.

🎥 Watch Basic authentication: How to add in ASP.NET Core 🎥
   • Basic authentication: How to add in A...  

💻 Download the code example 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 What is JWT?
0:34 Learn .NET with online courses
0:44 Learn about Basic authentication
1:04 Projects in Visual Studio
1:29 Install JWT Bearer middleware
1:59 Configure JWT settings
4:24 Configure JWT in ASP.NET Core
8:36 Add JWT to Swagger
9:49 Create JWT client
10:26 Generate JWT token
18:02 Create test controller
18:38 Test JWT in Swagger
20:02 Decode a JWT
20:28 More info about the code sample

#jwt #oauth #dotnet


Watch video JWT authentication: How to add in ASP.NET Core online without registration, duration hours minute second in high quality. This video was added by user Round The Code 28 April 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 6,380 once and liked it 78 people.