One of our customers recently asked us how they could sign their requests. We've investigated this and learned that when you're making unauthenticated requests against an origin like AWS Appsync, you have to use the AWS SDK to sign the request.
Based on their use case, there might be two different cases:
- A user of their application is authenticated, in which case they send a Bearer token in the Authorization header.
- The "backend" is actually making the request, so there's no JWT in the Authorization header.
In the first case, the Authorization header should not be altered. In the second case, as the request is unauthenticated, it needs to be signed using the AWS SDK.
Our intention to solve this problem was to build a very generic solution to modify the Request-Response chain, so that our users can use any signing algorithm they want or use the solution for other purposes.
Here's an example of how the AWS request signing could be implemented: