Ultimately, we need an endpoint for new users to register, as well as an endpoint for existing users to authenticate and retrieve a JWT in return. We already added a test user into the database as part of our seed data, so we can jump right into issuing JWTs to make sure our authentication configuration is working properly. Under the Features directory, create a new folder called Authentication, and then add a Controller.cs file with the following contents:
namespace ECommerce.Features.Authentication{ [Route("api/[controller]")] public class TokenController : Controller { private readonly SignInManager<AppUser> _signInManager; private readonly UserManager<AppUser> _userManager; private readonly IConfiguration _configuration; ...