I'm streaming

Fetching new Authorization tokens from AWS Congito through Postman

Create a lambada to fetch the token from Cognito, Return as { “id”: “idToken” }. We can go into postman and create a “Test” method and use the following:

let response = pm.response.json();
pm.environment.set("authToken", response.id);

For this example, I named the variable as {{authToken}}. So the headers will be Authorization: {{authToken}}. To expose the lambda, I use APIGateway. This will host our lambda, for an extra layer of “security”, I added x-api-key to our route so that you will need that to hit the cognito pool. We can even pass it in the payload.

 

{
 username: 'jon@hemstreet.io',
 password: 'abc123',
 region: 'us-east-1',
 webClientId: 'asdfasdfadsfaf',
 userPoolId: 'asdfasdfsdf2'
}

An inventive, entrepreneurial and positively unsatisfied mind that constantly pushes the tech boundaries to create new solutions and devices that change people’s lives.

Leave a Reply