Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bearer Authorization setup #70

Open
karthikavkannan24 opened this issue Apr 18, 2019 · 5 comments
Open

Bearer Authorization setup #70

karthikavkannan24 opened this issue Apr 18, 2019 · 5 comments

Comments

@karthikavkannan24
Copy link

karthikavkannan24 commented Apr 18, 2019

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.

@sudkumar
Copy link

sudkumar commented May 5, 2019

@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 🍻

@karthikavkannan24
Copy link
Author

karthikavkannan24 commented Jul 3, 2019

@sudkumar , Thanks for the reply. It works

@ducpm0301
Copy link

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

@karthikavkannan24
Copy link
Author

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?

@mtracz
Copy link

mtracz commented Jul 21, 2021

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"
			}
		}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants