swagger-php icon indicating copy to clipboard operation
swagger-php copied to clipboard

The Authorization specified in HeaderParameter cannot correctly try it out.

Open SwankyTigerYY opened this issue 10 months ago • 3 comments

success #[OA\HeaderParameter(name: 'Authorization1', description: 'token', in: 'header', required: true, schema: new OA\Schema(type: 'string'))]

error #[OA\HeaderParameter(name: 'Authorization', description: 'token', in: 'header', required: true, schema: new OA\Schema(type: 'string'))]

Is Authorization a Keyword?why?

SwankyTigerYY avatar Apr 25 '24 01:04 SwankyTigerYY

Could you provide some details about the error you are seeing?

DerManoMann avatar Apr 25 '24 04:04 DerManoMann

image image

SwankyTigerYY avatar Apr 25 '24 04:04 SwankyTigerYY

There is nothing special about it in swagger-php. However, OpenApi has special handling for security - https://spec.openapis.org/oas/v3.1.0.html#security-scheme-object.

Instead of configuring a raw header the OA\SecurityScheme annotation should be used, something like:

/**
 *     @OA\SecurityScheme(
 *         type="apiKey",
 *         securityScheme="http"
 *     )
 */

You might need to adjust type for your needs and perhaps also use other options depending.

DerManoMann avatar Apr 30 '24 22:04 DerManoMann