i am using L5-swagger from DarkaOnLine for my project. I want to use JWT Auth in my documentation. I have added this code :
/**
@OAS\SecurityScheme(
securityScheme="API Key Auth",
type="apiKey",
in="header",
name="Authorization",
)
**/
In swagger UI the "Authorize" button is showed and there is a form to fill with token. But after i enter it, i still got "token_not_provided" error in function that need token to access it.
Thanks in advance.
@OAS
annotations are for OpenAPI 3.0, where Bearer authentication is defined as type: http
+ scheme: bearer
:
/**
@OAS\SecurityScheme(
securityScheme="bearerAuth",
type="http",
scheme="bearer"
)
**/
Make sure your operations use security
with the same name as specified in securityScheme="<NAME>"
above. For example:
/**
* @OAS\Get(
* ...
* security={{"bearerAuth":{}}}
* ...
In Swagger UI's "Authorize" dialog, enter the token without the "Bearer" prefix.