@ApiBearerAuth() does not work on Method level
See original GitHub issue
As title said, the @ApiBearerAuth()
decorator does not work properly on method
level. It does work correctly on Controller
level. The documentations states that the decorator can work on either Method or Controller level. I was just wondering if this’s a bug or I didn’t implement it correctly.
Worked on Controller level
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Is it possible to add Authentication to access to NestJS ...
Securing access to your Swagger with HTTP Basic Auth using NestJS with Express. First run npm i express-basic-auth then add the following to ......
Read more >Bearer Authentication - Swagger
Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens.
Read more >Custom decorators | NestJS - A progressive Node.js framework
An ES2016 decorator is an expression which returns a function and can take a ... Decorators can be defined for either a class,...
Read more >Authentication with JsonWebToken in NestJS - Medium
JWT token authentication has become a de facto standard when it comes to ... body of the POST method that we will implement...
Read more >Swagger - Midway.js
Open the component ... At this time, swagger components can also be automatically identified, and can also ... Do not add @ApiBody() decorator...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am having this issue again, using @nestjs/common 5.0.0, @nestjs/core 5.0.0 and @nestjs/swagger 2.0.0
@nartc I solved it by add this line to main.ts (or wherever you register nestjs-swagger)
const options = new DocumentBuilder()
.addBearerAuth()
But in your controller/method you also need to define @ApiBearerAuth()
Hope this help !!