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'


Innovative, entrepreneurial and positively unsatisfied mind that constantly pushes the tech boundaries to create new solutions and devices that change people’s lives. Throughout my career, I have had the opportunity of having a multi-disciplinary experience, which led me to wear the hats of: Architect, IoT Consultant (Internet of Things Consultant), Developer, Designer, Engineer, Server Admin, Consultant and Project Manager – to name a few. Based on this diversified background, I get projects done by following smart ideas and well-planned goals. In a world which is getting more unconventional by the day, I use unconventional ways, and a very healthy dose of integrity, to create devices and solutions that help companies go from a steady present to a dynamic future.

You may also like...