我正在ASP.NET Core中开发Web API。
我正在寻找一种在授权范围内发送参数的方法,以便在标头中发送参数
答案 0 :(得分:0)
在选项中添加AddSecurityDefinition。 https://gist.github.com/mbasaran/39734d645edcc258fcb507a710139b7d
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "api", Version = "v1" });
c.AddSecurityDefinition("oauth2", new ApiKeyScheme
{
Description = "Standard Authorization header using the Bearer scheme. Example: \"bearer {token}\"",
In = "header",
Name = "Authorization",
Type = "apiKey"
});
});
答案 1 :(得分:0)