swagger OAuth2
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
swagger OAuth2
Hi. I have a node.js api, using swagger. I am trying to add security around each method to authenticate the user.
Using AWS Cognito user pool to authenticate users.
I am using swagger 2.0.
I have securityDefenitions setup in my json:
- Labels:
-
Swagger Editor
-
Swagger UI
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI @staylor2916396 ,
What Swagger library are you using in Node.js? Swagger (and OpenAPI) are about describing your APIs, and then using that definition to do fancy things like routing, validation, etc.
In Node.js case, I would imagine you'd want to look at something like https://www.passportjs.org/ for handling authentication on the code level.
On another point, having `security: []` doesn't add your security. You need to reference it by name, like `security: [ Bearer: [] ]`. See "Apply Security" in https://swagger.io/docs/specification/authentication/ for some more info there.
