I have a SwaggerHub definition and I want to use the 'Try it out' function to pull data from my API Gateway page. This API is restricted using a Cognito Authorizer.
Currently I have created a separate web page where I log into my Cognito UserPool and then it returns the id_token
. I then copy this value and paste it into my SwaggerHub definition in the Authorization
header value each time I make a call.
Is there a way I can do the authorisation directly from SwaggerHub rather than having to get the id token from another method first?
Yes you can, using security schemes. See https://swagger.io/docs/specification/authentication/.
See https://app.swaggerhub.com/apis/kanjih-ciandt/dsco-platform_api/3.0 for oauth2 example. It's not my API but one I found searching on SwaggerHub.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With