我有一个Web API(ASP.NET核心),我正在尝试调整swagger来进行调用.这些调用必须包含Authorization标头,我正在使用Bearer身份验证.来自Postman等第三方应用的电话也没问题.但我遇到了设置swagger标头的问题(由于某种原因我没有收到标头).这就是现在的样子:
"host": "localhost:50352",
"basePath": "/" ,
"schemes": [
"http",
"https"
],
"securityDefinitions": {
"Bearer": {
"name": "Authorization",
"in": "header",
"type": "apiKey",
"description": "HTTP/HTTPS Bearer"
}
},
"paths": {
"/v1/{subAccountId}/test1": {
"post": {
"tags": [
"auth"
],
"operationId": "op1",
"consumes": ["application/json", "application/html"],
"produces": ["application/json", "application/html"],
"parameters": [
{
"name": "subAccountId",
"in": "path",
"required": true,
"type": "string"
}
],
"security":[{
"Bearer": []
}],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "BadRequest",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}, …Run Code Online (Sandbox Code Playgroud) 我正在ASP.NET Core 1.0中创建一个REST api.我正在使用Swagger进行测试,但现在我为某些路线添加了JWT授权.(带UseJwtBearerAuthentication)
是否可以修改Swagger请求的标头,以便[Authorize]可以测试具有该属性的路由?