From the course: ASP.NET Core: Token-Based Authentication
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Adding the authentication controller - ASP.NET Core Tutorial
From the course: ASP.NET Core: Token-Based Authentication
Adding the authentication controller
- [Instructor] To work with our users in our web API, we are going to add a new controller. And that is going to be the authentication controller. In this controller, we are going to inject all the necessary services to work with user data. For that, let us go to Visual Studio and see it in action. In Visual Studio, I'll go to the Solution Explorer, and then right click in the Controllers folder, add a new controller. This is going to be an API controller, so I'll just go to the API in here, and then select the first option, API Controller dash Empty. And I click the Add button. Then next, you need to define a controller name, and I'm going to name this controller AuthenticationController. And then click the Add button one more time. Now that the controller is added, I'm going to add all the necessary services in here, and then inject them in the controller constructor so we can use them in the API endpoints of this…
Contents
-
-
-
-
(Locked)
Setting up Entity Framework Core8m 44s
-
(Locked)
Adding default identity tables using EF Core8m 51s
-
Configuring token-based authentication9m 38s
-
(Locked)
Adding the authentication controller4m 56s
-
(Locked)
Registering new users using UserManager9m 8s
-
(Locked)
Logging in users4m 54s
-
Generating an access token10m 17s
-
(Locked)
Adding the RefreshToken table5m 4s
-
(Locked)
Generating and storing refresh tokens4m 6s
-
(Locked)
Injecting TokenValidationParameters2m 57s
-
(Locked)
Refreshing expired tokens12m 6s
-
(Locked)
-
-