2

I've got some lambdas behind Amazon's API Gateway, which is configured to restrict access to Cognito authenticated users. All works fine for users coming via a UI.

I'd like to test those APIs separately to the UI, using Postman ideally or failing that perhaps curl.

How can I send a Cognito-authenticated request via Postman, curl or similar, to the API Gateway?

rich
  • 18,987
  • 11
  • 75
  • 101
  • Possible duplicate of [How setup header in Postman for Api Gateway authenticated with Cognito?](https://stackoverflow.com/questions/46919965/how-setup-header-in-postman-for-api-gateway-authenticated-with-cognito) – Quentin Hayot Jan 25 '19 at 12:58

2 Answers2

1

Try using Insomnia as a Rest client: https://insomnia.rest/

I see it has a tab for AWS auth settings.

enter image description here

Shaunti Fondrisi
  • 1,081
  • 10
  • 13
  • Also remember to set CORS, and you can really just use any HTTP client and just add your jwt to the auth header. Authorization: authResponse.getIdToken().getJwtToken() – Shaunti Fondrisi Apr 01 '19 at 19:44
0

just have a look at the following post, i think it'd be helpful for you.

How setup header in Postman for Api Gateway authenticated with Cognito?

Asad Mehmood
  • 514
  • 2
  • 12
  • I'm not using a federated identity provider, I'm using Cognito username and password auth. – rich Jan 25 '19 at 13:11
  • if you are using cognito user pool, get the authentication token from cognito and provide in Authorization : Bearer . you can get the tocken from your frontend. – Asad Mehmood Jan 25 '19 at 13:27