swaager 配置token令牌

案例如下:

options.AddSecurityDefinition("Bearer", new ApiKeyScheme
{
Description = "Authorization format : Bearer {token}",
Name = "Authorization",
In = "header",
Type = "apiKey"
});//api界面新增authorize按钮
options.AddSecurityRequirement(new Dictionary<string, IEnumerable<string>> {
{
"Bearer",
Enumerable.Empty<string>()
} });
});

 //代码位置如下:

原文地址:https://www.cnblogs.com/redfull/p/9984284.html