1

I am using Swagger UI to generate api doc and want to call api in this page for grape api. I set the security_definitions as below:

add_swagger_documentation(
  hide_documentation_path: true,
  doc_version: '18.0',
  mount_path: '/api_doc',
  add_version: true,
  hide_format: true,
  info: {
  title: "Search API documentation"
  },
  security_definitions: {
      ApiKeyAuth:{
        type: "apiKey",
        name: "X-Auth-Token",
        in: "header",
        description: "Requests should pass an api_key header."
      }
  },
  security: {
    ApiKeyAuth: []
  }
)

But when input the value and sent the request, there is no value in request header.

Set the apikey value

calling the api

李梦驰
  • 59
  • 3

1 Answers1

1

security is an array so it should be

security: [{ ApiKeyAuth: [] }]
Helen
  • 87,344
  • 17
  • 243
  • 314