Skip to content
Advertisement

How to access API from AWS API Gateway with PHP SDK 3

Can anyone help figure out how to use AWS Signature, AWS Credentials and PHP SDK 3 to access an API Gateway API? It seems like AWS Signature does not actually attach headers to a Guzzle request.

Here is my code:

JavaScript

And the error I’m getting is:

JavaScript

Line 29 of access.php is:

JavaScript

It doesn’t appear from the var_dumps that any headers are being added. I am able to successfully test this endpoint in the API Gateway and in Postman. Enabling CORS does not appear to make a difference.

Has anyone solved this issue yet?

This issue is also covered at https://forums.aws.amazon.com/post!reply.jspa?messageID=795522 and https://forums.aws.amazon.com/thread.jspa?messageID=774631&tstart=0 but there are no solutions there.

Advertisement

Answer

Thanks, Michael, for your help above.

You have to use the return from new SignatureV4, which is a modified request.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement