Skip to content

Commit 3ddeb9c

Browse files
authored
Update jwt.md (#1559)
https://stackoverflow.com/a/69801383/4601822 Added correct code for JWT (Bearer) auth in Swagger UI
1 parent 95c7535 commit 3ddeb9c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/jwt.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Want to test the routes of your JWT-authentication-protected API?
165165
api_platform:
166166
swagger:
167167
api_keys:
168-
apiKey:
168+
JWT:
169169
name: Authorization
170170
type: header
171171
```
@@ -238,6 +238,13 @@ final class JwtDecorator implements OpenApiFactoryInterface
238238
],
239239
]);
240240
241+
$schemas = $openApi->getComponents()->getSecuritySchemes() ?? [];
242+
$schemas['JWT'] = new ArrayObject([
243+
'type' => 'http',
244+
'scheme' => 'bearer',
245+
'bearerFormat' => 'JWT',
246+
]);
247+
241248
$pathItem = new Model\PathItem(
242249
ref: 'JWT Token',
243250
post: new Model\Operation(

0 commit comments

Comments
 (0)