Issuing JWTs

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; ...

Get ASP.NET Core 2 and Vue.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.