Forum Discussion

dzVlado's avatar
dzVlado
Occasional Visitor
4 years ago
Solved

V3.0 with Laravel framework, authentication is not working

Trying to authenticate routes using securityScheme: (type:"http", name: "Authorization", in:"header", scheme:"bearer", bearerFromat:"JWT") but can't authorize routes. Lock is not changing.

swagger-v3.php

/**
* @OA\OpenApi(
* @OA\Info(
* version="1.0.0",
* title="Swagger Petstore",
* description="This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
* termsOfService="http://swagger.io/terms/",
* @OA\Contact(
* email="apiteam@swagger.io"
* ),
* @OA\License(
* name="Apache 2.0",
* url="http://www.apache.org/licenses/LICENSE-2.0.html"
* )
* ),
* @OA\Server(
* description="OpenApi host",
* url="https://petstore.swagger.io/v3"
* ),
* @OA\ExternalDocumentation(
* description="Find out more about Swagger",
* url="http://swagger.io"
* )
* )
*/

security.php

/**
* @OA\Components(
* @OA\SecurityScheme(
* type="http",
* description="Use a global client_id / client_secret and your username / password combo to obtain a token",
* name="Authorization",
* in="header",
* scheme="bearer",
* bearerFormat="JWT",
* securityScheme="bearerAuth",
* )
* )
*/

in controller


/**
* @OA\Get(
* ...,
* security={{
* "bearerAuth":{}
* }},

 

  • Thanks for posting the question. Unfortunately, none of the PHP libraries are ours and we don't have the knowledge to provide support for them. Please find the proper support channel for the libraries you use and try there.

1 Reply

  • Thanks for posting the question. Unfortunately, none of the PHP libraries are ours and we don't have the knowledge to provide support for them. Please find the proper support channel for the libraries you use and try there.