SwaggerLume
SwaggerLume copied to clipboard
Bearer Authorization setup
Hi,
I'm using DarkaOnLine/SwaggerLume in my Lumen project. Everything works fine except the Authorization. I'm using JWT authentication and I want to pass a Bearer
I've added following codes:
- @OAS\SecurityScheme(
-
securityScheme="bearerAuth",
-
type="apiKey",
-
in="header",
-
name="Authorization",
- ) **/
and /** * @OA\Get( * tags={"User Managment"}, * path="/getusers", * description="", * summary="Get users list", * operationId="getUsers", * @OA\Response( * response=200, * description="Users Listed", * ), * security : { bearerAuth: []} * ) */
But still I'm getting token not provided issue.
Please feedback.
Thanks
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
@karthikavkannan24 Please try this.
// Somewhere in your middleware or any other place
/**
* @OA\SecurityScheme(
* type="http",
* description="Login with email and password to get the authentication token",
* name="Token based Based",
* in="header",
* scheme="bearer",
* bearerFormat="JWT",
* securityScheme="apiAuth",
* )
*/
/**
* @OA\Get(
* path="/resources",
* summary="Get the list of resources",
* tags={"Resource"},
* @OA\Response(response=200, description="Return a list of resources"),
* security={{ "apiAuth": {} }}
* )
*/
This repository is just a nice wrapper to the swagger-php and lumen, so, it is not a good place to find solution for
how to do this in swagger-php
. swagger-php would be a place to go for these issues.
Hope this helps 🍻
@sudkumar , Thanks for the reply. It works
I am using lume api 8, darkaonline/swagger-lume:8.* and openapi 3.0.0, i am try
/**
* @OA\SecurityScheme(
* securityScheme="bearerAuth",
* type="apiKey",
* name="Authorization",
* in="header",
* )
*/
and /** * @OA\POST( * path="/v1/api/me", * summary="Get info current user login", * security={{ "bearerAuth": {} }}, ..... but still not working, any body can help me and help me check reson? Thanks so much
I am using lume api 8, darkaonline/swagger-lume:8.* and openapi 3.0.0, i am try
/** * @OA\SecurityScheme( * securityScheme="bearerAuth", * type="apiKey", * name="Authorization", * in="header", * ) */
and /**
- @OA\POST(
- path="/v1/api/me",
- summary="Get info current user login",
- security={{ "bearerAuth": {} }}, ..... but still not working, any body can help me and help me check reson? Thanks so much
Which one is not working? Only authorisation?
https://swagger.io/docs/specification/authentication/bearer-authentication/ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#jwt-bearer-sample
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"description": "Passport security.",
"scheme": "bearer",
"bearerFormat": "JWT"
}
}
}