Laravel Swagger (l5-swagger) multiple apiKey in header securityScheme

868 views Asked by At

My api requires two fields in the header and it's described in the config/l5-swagger.php like this:

        'securityDefinitions' => [
            'securitySchemes' => [
                'app_id' => [
                    'type' => 'apiKey',
                    'description' => 'API integration application identifier',
                    'name' => 'X-App-Id',
                    'in' => 'header',
                ],
                'access_token' => [
                    'type' => 'apiKey',
                    'description' => 'API integration access token',
                    'name' => 'X-Access-Token',
                    'in' => 'header',
                ],
            ],
            'security' => [
                [
                    'app_id' => [],
                    'access_token' => [],
                ],
            ],
        ],

On the generated api documentation, when I click Authorize it renders the form with separate fields like this:

enter image description here

How do I tell l5-swagger to merge both of these fields together and not be treated separately?

1

There are 1 answers

1
Helen On

Your code is correct. This is just how Swagger UI renders API key pairs. Here's an existing enhancement request to improve the representation of API key pairs:
https://github.com/swagger-api/swagger-ui/issues/3521