Skip to content

How to use the code returned from Cognito to get AWS credentials?

Right now, I’m struggling to understand AWS Cognito so maybe someone could help me out. I set a domain to serve Cognito’s hosted UI for my User Pool like what’s described here. So when I go to https://<my-domain><MY_POOL_CLIENT_ID>&redirect_uri=https://localhost:8080 I get a login page where my users can login to my app with Google. That part is working great.

I confused about what to do with the code that is returned from that page once my user logs in. So once I get redirected to Google and authorize the application to view my information, I get redirected back to one of my URLs with a code in the query params. Right now I’m redirecting to localhost, so the redirect URL look like this:


What exactly is this code? Also, how do I use it to get access to AWS resources for my user?


you can find the “Authorization code grant” in the doc :