Integrate the app with Cognito User Pool

Now that we have a user pool and app client, we can put those configurations in our app and give it a quick test.

  • Copy the cognito pool id in app-config.js

  • Copy the App client id in app-config.js

  • Make sure you have set correct region in the app-config.js as well.

Move the changes to the S3 bucket again. If I am doing a simple test around S3, I usually prefer the s3 sync command which can easily move the changed files to the S3 bucket instead of doing full copy or integrate other SDK.

$ aws s3 sync . s3://<your bucket> --profile <AWS profile name>

Reload the page and it will not show any errors.

At this stage, a user can go to the Register option and signup.

Once the signup and verification part is done, do the login. You should be able to log in fine but the application will now show an error message of invalid identity pool.

This is because we are trying to capture the Cognito Identity attached to the logged-in user and configure our session to use other AWS services.

userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData);
cognitoUser = userPool.getCurrentUser();
Missing Identity Pool error

Last updated

Was this helpful?