# Token Generation on AWS for Authorization of API

**URL:** <https://community.postman.com/t/token-generation-on-aws-for-authorization-of-api/16755>\
**Category:** Help Hub\
**Created:** [October 14, 2020, 3:37pm UTC](https://community.postman.com/t/token-generation-on-aws-for-authorization-of-api/16755 "2020-10-14T15:37:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aakashjain8693](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@aakashjain8693](https://community.postman.com/u/aakashjain8693)\
**Post date:** [October 14, 2020, 3:37pm UTC](https://community.postman.com/t/token-generation-on-aws-for-authorization-of-api/16755/1 "2020-10-14T15:37:16Z")

</div>

Hi Team,

As of now we are generating token for authentication of API from Command Prompt(CMD) based on the AWS commands.  
Since its manual and tedious task that’s why we are moving towards the automation.  
Towards the end goal of automation, Dev team created the POST http method API but they tested with redirect\_uri as [https://www.google.com](https://www.google.com)  
Now question is how we can get the same response over the Postman? What gonna be value of redirect\_uri value.

Step to reproduce:  
Dev team Testing:

1. Enter the url in any browser:  
[https://cdp.amazoncognito.com/login?client\_id=6mcf8kpvtjcjpa32i7q8t2ts1p&response\_type=token&scope=email+openid+profile&redirect\_uri=https://www.google.com](https://cdp.amazoncognito.com/login?client_id=6mcf8kpvtjcjpa32i7q8t2ts1p&response_type=token&scope=email+openid+profile&redirect_uri=https://www.google.com)

2.Enter the valid cred.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/e/5/e5f71c80acefe46b73a9a6ab579437a4c7ceaff8.png)

1. Once you entered the correct cred., You will see the required response at url level only.

Testing through Postman;  
Step to reproduce:

1. Enter the url with Post method with Paramameters

Question:  
1.What gonna be parameter based on the above dev url?  
2.What gonna be type of authorization? Means in which section we will apply the username/password?  
3. What gonna be redirect\_uri value?

Let me know still needed more info, Since further data cant display here due to security concern.

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [October 15, 2020, 11:26am UTC](https://community.postman.com/t/token-generation-on-aws-for-authorization-of-api/16755/2 "2020-10-15T11:26:42Z")

</div>

I recommend looking into OAuth2 to understand how to get everything to run in Postman.

Below is a tutorial that can help you get started.

[![](https://img.youtube.com/vi/YpmEkNJubHA/maxresdefault.jpg "OAuth 2.0 Authorization Flow using the Dropbox API and Postman") ](https://www.youtube.com/watch?v=YpmEkNJubHA)

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [October 16, 2020, 12:14pm UTC](https://community.postman.com/t/token-generation-on-aws-for-authorization-of-api/16755/3 "2020-10-16T12:14:48Z")

</div>

I’ve also written [this blog post](https://www.readysetcloud.io/blog/allen.helton/how-to-automate-oauth2-token-renewal-in-postman-864420d381a0/) on how to automate token renewal.

I would recommend watching that video that @vdespa provided though.

---

<div class="post-metadata">

**Author:** ![aakashjain8693](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@aakashjain8693](https://community.postman.com/u/aakashjain8693)\
**Post date:** [October 25, 2020, 8:50am UTC](https://community.postman.com/t/token-generation-on-aws-for-authorization-of-api/16755/4 "2020-10-25T08:50:19Z")

</div>

@allenheltondev @vdespa Thanks for the suggestion.  
I just went through the above mentioned video and docs.

A bit complex process but trying to get into SO here is the process I followed for my requirement.

Here the basic details what QA team have:

“[Signin](https://cdp-api-dev.auth.us-west-2.amazoncognito.com/login?client_id=6mcf8kpvtjcjpa32i7q8t2ts1p&response_type=token&scope=email+openid+profile&redirect_uri=https://www.google.com)”

[https://cdp-api-dev.auth.us-west-2.amazoncognito.com/login](https://cdp-api-dev.auth.us-west-2.amazoncognito.com/login)  
client\_id=6mcf8kpvtjcjpa32i7q8t2ts1p  
response\_type=token  
scope=email+openid+profile  
redirect\_uri=[https://www.google.com](https://www.google.com)

Tried with Grant Type as password cred and console error as followed:  
Error: Could not complete OAuth 2.0 token request

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/9/e/9e1f9c7e8aff13d67122ed69daa0f680734e25ae.png)

Tried with Gant Type as Authorization Code and error coming over the browser as below:  
Note: I just added client secret as url cred but not sure what gonna be value.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/a/8/a8f8acb26329527bd86e167940dc8a7ff13a6d60.png)

Once we click on request token, It navigate to the browser level and throwing error as

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/f/4/f416b2e33d85e5c5adfcf45096a9aea5497eab32.png)

Really looking forward since very beginner for such processes.

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [October 26, 2020, 11:28am UTC](https://community.postman.com/t/token-generation-on-aws-for-authorization-of-api/16755/5 "2020-10-26T11:28:27Z")

</div>

The specific error you’re getting is stating the redirect uri is wrong.  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/c/c/ccf1cc1effbc0c2b4bc83efbfef3459d3992e866.png)  
From the details you provided above, I’d imagine you’d need to change the redirect to [google.com](http://google.com) instead of the postman callback.

Or the easier method might be to have a developer whitelist the postman callback url
