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