i'm trying to use swagger zircote to create the swagger ui json. for my application i use JWT and i need the following swagger code in my json:
"securityDefinitions": {
"Bearer": {
"in": "header",
"type": "accessToken",
"name": "Authorization"
}
},
But i dont know how i create that code with swaggers zircote. I've tried the following code:
* @SWG\Swagger(
* schemes={"https"},
* @SWG\SecurityDefinitions(
* bearer={
* type="apiKey",
* name="Authorization",
* in="header"
* }
* ),
but this results in the following error:
The annotation "@Swagger\Annotations\SecurityDefinitions" in .\index.php on line 2 does not exist, or could not be auto-loaded.
Can someone help me, i cant find any good documentation about this, maybe its to specific, but i hope someone can help me.
Thanks!
https://stackoverflow.com/questions/42362488/swagger-doctrine-zircote-bearer-authorization-code
You're almost there:
* @SWG\Swagger(
* schemes={"https"},
* @SWG\SecurityScheme(
* securityDefinition="Bearer",
* type="apiKey",
* name="Authorization",
* in="header"
* ),
I had to lookup the annotation too, the list is here
I named the annotation annotation SecurityScheme as that is the name that is used in the spec SecurityDefinition might have been a better name.
Did you get this working with the Swagger UI? Using Swagger UI, it builds the Auth form, but when I enter a key, and perform an API request it does not append the headder
I'm having the exact same issue as @mattbryson
Swagger-PHP is only responsible for generating the swagger.json
Report issues to swagger-ui when the json is correct, but the client doesn't behave as expected.
@bfanger hi,
Is it possible to do that automatic authentication? After one (login) API point return token without manually adding to authorise section?
Most helpful comment
You're almost there:
I had to lookup the annotation too, the list is here
I named the annotation annotation
SecuritySchemeas that is the name that is used in the spec SecurityDefinition might have been a better name.