aws-samples / api-gateway-secure-pet-store

Amazon API Gateway sample using Amazon Cognito credentials through AWS Lambda
Apache License 2.0
308 stars 113 forks source link

Testing Secured endpoints with API-Gateway / Postman is not clear #26

Closed ergind closed 7 years ago

ergind commented 7 years ago

I am able test login / register user and get valid accesskey, secretKey and sessionToken. However I cannot test other endpoints /pets or /pets/{petId}. I get below error message. I really appreciate if someone can explain how can I test this without using IOS app via API Gateway console and/or Postman (or some other REST API client).

Error Msg: Thu Jan 26 09:14:47 UTC 2017 : Execution failed due to configuration error: API Gateway could not determine the callers credentials

Note: Authorization set to AWS_IAM and my swagger file's credentials value is set to credentials: arn:aws:iam:::user/ as stated in the documentation.

vipiny commented 7 years ago

If you are using Postman set the below parameters in headers. Select Authorization type as "AWS Signature", then pass the Access Key and Secret Key which u get in response under credentials. Add a header key "X-Amz-Security-Token" and pass the sessionToken as its value.

ergind commented 7 years ago

Thanks, it's working after adding X-Amz-Security-Token.

Imanullah commented 6 years ago

I'm not sure it will secure..... for SSR website and using axios the headers will easily inspect showed resource code