Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authenticate to Cognito from SwaggerHub for calls to API Gateway

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?

like image 757
Mark Hayward Avatar asked Sep 15 '25 17:09

Mark Hayward


1 Answers

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.

like image 176
Rakesh Avatar answered Sep 17 '25 19:09

Rakesh