Create the Identity Pool
Now, our application is ready but does not have any AWS credentials to use any of the AWS services directly. To allow our application to use AWS services like S3, we will need to configure an Identity pool and assign a role with an authenticated user.
Go to the
Federated identities
from the top-left section in Cognito consoleSelect
Create new identity pool
Give the
identity pool name
Open the
Authentication providers
sectionHere we will configure the source of our user data, in our case, it would be a Cognito User Pool that we previously created.
Copy the
User Pool ID
andApp client id
from the app-config.js configuration hereContinue the setup with
Create Pool
Now we will need to attach the
IAM Roles
to our Identity pool. You will see two roles, one for Authenticated and the next one for Unauthenticated users.Authenticated users are those who have a valid Cognito user pool session after doing the sign-in, and Unauthenticated users are those who are yet to either signup or has a valid user but not yet signed in.
We will keep this to default and complete the setup with
Allow
command at the bottomCopy the
Identity pool id
and save to app-config.js
Now our app contains both the Cognito user pool and the Cognito identity pool. Move the current changes to the S3 bucket and reload the app. If you are already signed-in then the log should show the token and expiry detail.

Reload the application now and it should work.

Last updated
Was this helpful?