Swashbuckle是否有任何有关如何将不记名令牌传递给API的文档,升级到最新的swashbuckle 2.1版后,我无法传递不记名令牌
答案 0 :(得分:2)
services.AddSwaggerGen(options =>
{
options.AddSecurityDefinition("oauth2", new ApiKeyScheme
{
Description = "Standard Authorization header using the Bearer scheme. Example: \"bearer {token}\"",
In = "header",
Name = "Authorization",
Type = "apiKey"
});
options.OperationFilter<SecurityRequirementsOperationFilter>();
您将需要一个SecurityRequirementsOperationFilter的副本,可以通过谷歌搜索找到它,或者从我的Swashbuckle.AspNetCore.Filters软件包中安装它。