Generating JWTs
The first step is to generate JSON web tokens in the ASP.NET Core Web API project. For this, let's create a web API Controller--AuthController.
In this AuthController, we will use CredentialsModel containing a username and password to check against AppUsers. If the users exist, then we generate a JWT token that is passed as a response.
We will use the Entity Framework Core In-Memory provider to generate database context and tables and seed data to it. Refer to Chapter 9, Integration with Database, on working with different databases using EF 6, EF Core, and Dapper ORMs.
The AuthController code will use PersonalBudgetContext, which is the EF Core database context, and IConfigurationRoot, which reads the appsettings.json file ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access