api-platform / core

The server component of API Platform: hypermedia and GraphQL APIs in minutes
https://api-platform.com
MIT License
2.45k stars 881 forks source link

Feature: Add Support for HTTP Authentication (HTTP Basic, Bearer) #6664

Open toitzi opened 2 months ago

toitzi commented 2 months ago

Description
As discussed in #6661 there is currently no support for Swaggers HTTP Auth Mechanism, more specifically for Basic Authentication and Bearer Authentication. Especially in Laravel (where the default goto for API Authentication usually is Laravel Scout), it can be useful to have the option to add a bearer token and authorize requests in the swagger ui.

Example
Possible configuration option:

'swagger_ui' => [
    'enabled' => true,
    'http_auth' => [
        'Personal Access Token' => [
            'scheme' => 'bearer', // or "basic"
            'bearerFormat' => 'JWT',
        ],
    ],
]

Here is what that would look like in the Swagger UI:

image

stale[bot] commented 6 days ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

toitzi commented 3 days ago

PR is open, issue is not stale