을 사용하여 Swagger (ASP.NET Core) 설정하기 나는 웹 API (ASP.NET Core)를 가지고 있으며, 그것을 호출하기 위해 swagger를 조정하려고합니다. 호출에는 Authorization 헤더가 있어야하며 Bearer 인증을 사용하고 있습니다. 우편 배달부 등의 타사 앱에서 걸려 오는 전화는 문제가 없습니다. 하지만 (내가 헤더를받지 못하는 이유 때문에) 허풍에 대한 헤더를 설정하는 데 문제가 있습니다. 이것은 지금과 같은 모습입니다 : 모든권한 부여 헤더 (무기명)
"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"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "InternalServerError",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"deprecated": false
}
},
당신의 설명이 나를 위해 문제를 해결했습니다. –
좋은 답변이지만 ABP 상용구를 사용하면 동적 웹 API (https://aspnetboilerplate.com/Pages/Documents/Dynamic-Web-API) –
@ VadimK와 함께 작동하지 않습니다. 업그레이드 할 때까지 완벽하게 작동했습니다. .NET Core 2.0 – monty