How to make a Get request to API Gateway using Angular?

Question:

I’m trying to hit this AWS endpoint:

which returns:

  • In my Angular code I’m using AWS4 library to send secretAccessKey, accessKeyId and sessionToken to authenticate the user, but I get the following error:

core.js:12501 ERROR Error: Uncaught (in promise): Error: Request
failed
with status code 403
Error: Request failed with status code 403

  • Does anyone know how to use AWS4 properly with Angular so I can make this simple GET call? or does anyone know another way to make this call using those keys and token for authentication? Thanks a lot in advance!

This is how I get the keys and token (This part works great)

Now, this is how I’m using those keys and token to make the GET call.

Answer:

I got it working and I’ll share my solution in case anyone else out there needs it!

I ended up using http service from angular and not axios. Here’s my solution;

Leave a Reply