staylor2916396
2 years agoNew Member
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:
"securityDefinitions": {
"Bearer": {
"type": "oauth2",
"flow": "accessCode",
"authorizationUrl": "https://xxxxxxxxxx.auth.us-east-2.amazoncognito.com/oauth2/authorize"
}
}
also have security setup for all methods:
"security": [],
I am not sure I understand the flow correctly, as OAuth2 has 2 basic steps 1)authenticate username/password, send back CODE(authorizationUrl) 2)get JWT from code (tokenUrl)
My app is getting the CODE back from the authorizationURL but swagger does not know what to do with the redirect or how to call the tokenUrl to get the JWT.
Would like some help so that on my swagger page, user clicks the Authorize button, enter user credentials and grabs the JWT needed to pass in to the header in the api calls.
thanks for any help and guidance.