开发环境 系统版本: win10 .NET SDK: NET8 开发工具:vscode 参考引用:使用 dotnet user-jwts 管理开发中的 JSON Web 令牌 注意:以下示例中的端口、token等需替换成你的环境中的信息 创建项目 运行以下命令来创建一个空的 Web 项目,并添加 Microsoft.AspNetCore.Authentication.JwtBearer NuGet 包: dotnet new web -o MyJWT cd MyJWT dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer 将 Program.cs 的内容替换为以下代码(略微改动): using System.Security.Claims; var builder = WebApplication.CreateBuilder(args); builder.Services.AddAuthorization(); // 默认的Scheme是Bearer //...