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>()
} });
});
//代码位置如下: