У меня есть веб-API (ASP.NET Core), и я пытаюсь настроить swagger для выполнения вызовов из него.
Вызовы должны содержать заголовок авторизации, и я использую аутентификацию на предъявителя.
Вызовы из сторонних приложений, таких как 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"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "InternalServerError",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"deprecated": false
}
},
Подробнее здесь: https://stackoverflow.com/questions/434 ... ers-bearer