New Identity API endpoints in ASP.NET Core 8
In the previous sections, we learned how to implement authentication and authorization using the built-in Identity APIs in ASP.NET Core. We developed a couple of endpoints to register, log in, and manage users and roles. ASP.NET Core 8.0 introduces a new set of features to simplify authentication for web APIs. In this section, we will introduce these new endpoints.
Note that this new feature is only for simple authentication scenarios. The token generated by the Identity API endpoints is opaque, not a JWT token, which means it is intended to be used by the same application only. However, it is still a choice for a quick start. In ASP.NET Core 8.0, we can use a new MapIdentityApi()
method to map the Identity API endpoints without writing any implementation as we did in the previous sections. Let’s learn how to use it:
- First, follow steps 1 to 5 in the Creating a sample project with authentication and authorization section...