Edmond Tamas
Edmond Tamas

Reputation: 3295

AWS Cognito - How to exchange authorization code for access tokens?

I am trying to wrap my head around some oAuth concepts. What I don't understand is, how to "exchange the authorization code for an access token"?

aws doc example:

POST https://mydomain.auth.us-east-1.amazoncognito.com/oauth2/token&
Content-Type='application/x-www-form-urlencoded'&
Authorization=Basic aSdxd892iujendek328uedj

grant_type=authorization_code&
client_id=djc98u3jiedmi283eu928&
code=AUTHORIZATION_CODE&
redirect_uri=com.myclientapp://myclient/redirect

Is this done via browser URL or via XMLHttpRequest?
Thanks

Upvotes: 1

Views: 1368

Answers (2)

agent420
agent420

Reputation: 3511

You do not need to use 'XMLHttpRequest'. As Jitendra mentioned, since this is a POST, you can't directly put it in the address bar which makes a GET call. But if you want to test this, you can use Postman to do so.

If you want to know how to use this in your web application, you can use any library to make the POST call as long as you set the right parameters. For example, if your application uses jQuery, you can use jQuery.post() to do so.

Upvotes: 1

Jitendra Chaudhari
Jitendra Chaudhari

Reputation: 64

What i can figure out is grant_type,code,etc are part of URL but as this is the POST you can not simply put it in browser.

Upvotes: 0

Related Questions