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

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