Description
After your update, 2.2.0, if someone is using your boilerplate project, it will stop working because there is an incompatibility with typescript-rest-swagger
and multiple authenticators. I've added the stack trace in this other bug #91. Can you please update the documentation with a relevant example on how to use the securityDefinitions
in swagger.config.json
and the Swagger UI with Bearer Authorization
?
I have this in swagger.config.json
:
"securityDefinitions": {
"Bearer": {
"type": "apiKey",
"in": "header",
"name": "Authorization"
}
}
This produces the following Swagger UI authorization:
However, when I try any request in Swagger UI, the Authorization Header is not added: curl -X GET "http://localhost:8080/users/1/accounts?includeExpired=true" -H "accept: application/json"
I then updated to 2.2.0 and tried to add Server.registerAuthenticator(new MyCustomTokenAuth(), 'MyAuth')
; and on my controller, I use @Security('ROLE_USER', 'MyAuth')
but it seems that typescript-rest-swagger
refuses to generate the swagger file with the following error:
node_modules/typescript-rest-swagger/dist/metadata/controllerGenerator.js:93
scopes: d.arguments[1] ? d.arguments[1].elements.map(function (e) { return e.text; }) : undefined
TypeError: Cannot read property 'map' of undefined
Could you update your boilerplate example and the documentation to provide a clear example on how to achieve this? Thanks.