Skip to content

Commit f9c9cfe

Browse files
author
LDFOUR\luisd
committed
fix auth api swagger
1 parent 2e0b539 commit f9c9cfe

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

app/Http/Controllers/Controller.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
* description="API Base URL"
2020
* )
2121
* )
22+
* @OA\SecurityScheme(
23+
* securityScheme="ApiKeyAuth",
24+
* type="apiKey",
25+
* in="header",
26+
* name="x-api-key"
27+
* )
2228
*/
2329
class Controller extends BaseController
2430
{

config/l5-swagger.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,18 @@
169169
* API security definitions. Will be generated into documentation file.
170170
*/
171171
'securityDefinitions' => [
172-
'securitySchemes' => [],
173-
'security' => [],
172+
'securitySchemes' => [
173+
'ApiKeyAuth' => [
174+
'type' => 'apiKey',
175+
'description' => 'Enter your API key in the header',
176+
'name' => 'x-api-key',
177+
'in' => 'header',
178+
],
179+
],
180+
'security' => [
181+
['ApiKeyAuth' => []],
182+
],
174183
],
175-
176184
/*
177185
* Set this to `true` in development mode so that docs would be regenerated on each request
178186
* Set this to `false` to disable swagger generation on production

0 commit comments

Comments
 (0)