Adding the TokenController

From Solution Explorer, right-click on the /Controllers/ folder and select Add | New Item, expand the ASP.NET Core node to the left, pick the Web API Controller class, call it TokenController.cs, and click on OK to create it. Here's the full source code of the new controller class (relevant lines are highlighted):

using System;using System.Collections.Generic;using System.Linq;using System.Threading.Tasks;using Microsoft.AspNetCore.Mvc;using System.Reflection.Metadata;using TestMakerFreeWebApp.ViewModels;using TestMakerFreeWebApp.Data;using Microsoft.AspNetCore.Identity;using System.IdentityModel.Tokens.Jwt;using System.Security.Claims;using Microsoft.Extensions.Configuration;using Microsoft.IdentityModel.Tokens; ...

Get ASP.NET Core 2 and Angular 5 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.