-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
Description
I think there is some problems when you need to share API documentation using auth.
I'm using
$config = new Config([
'username' => 'aaa',
'password' => 'bbb',
'database' => 'ccc',
'tables' => 'products',
'openApiBase' => json_encode(array(
"info" => array(
"title" => "Title",
"version" => "1.0.0",
),
"components" => array(
"securitySchemes" => array(
"ApiKeyAuth" => array(
"type" => "apiKey",
"in" => "header",
"name" => "X-API-Key",
)
)
)
)),
// auth
'apiKeyAuth.mode'=> 'required',
'middlewares' => 'cors,apiKeyAuth',
'apiKeyAuth.keys' => 'Vp7LxyEpfwYjSVm',
]);
In https://petstore.swagger.io/?url=https://<your domain>/api.php/openapi
there is no way to pass the auth-key.
I think you should define in json the option to enable auth also in swagger (or similar).
Metadata
Metadata
Assignees
Labels
Projects
Milestone
Relationships
Development
Select code repository
Activity
mevdschee commentedon May 17, 2024
I know
I'm not sure I properly understand what it is you are proposing. Can you try to clarify this for me?
Probably, what change do you think would be needed in the openapi to support authenticating using the api key?
I'm looking forward to your suggestion for improvement.
Sparviero-Sughero commentedon May 21, 2024
Hi mevdschee (tnx for your amazing job).
With the code
swagger show the Authorize button.
Then:
Swagger show "Loading" message and the API doesn't work.
I don't know why :o(
Maybe there is some options you need to add to json to enable auth on swagger?