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>()
} });
});

 

 //代码位置如下:

 

posted @ 2018-11-19 17:30  飞刀软件  阅读(444)  评论(0编辑  收藏  举报