📔
ServerlessDocs - Serverless File Service
  • Introduction
  • Why Serverless!!
  • Prerequisites
  • User Management
    • Authentication
    • Amazon Cognito
    • Create the User Pool
    • Create an App Client
    • Integrate the app with Cognito User Pool
    • Create the Identity Pool
    • Validate the setup
    • Troubleshooting
  • Manage Documents with AWS S3
    • Authorization
    • Update Cognito Identity Pool Auth Role
    • S3 Documents Bucket Folder Structure
    • Validate the Access Permissions
    • Public and Private files access
    • Upload Files to S3
    • Download Files
    • Delete Files
    • Share Files
  • More Security Configurations
    • Cognito user emails
    • Password policies
    • Allow only Organization and Whitelisted users to Signup
    • Allow admin users to upload Public files
    • Notify Admin users when a new user signup
    • Enable Multi-factor Authentication (MFA)
  • User Operations
    • Password Reset / Forgot Password
    • Resend Verification Code
  • Serverless APIs
    • APIs
    • Secure APIs using API Gateway Authorizer
    • Access Cognito values in Lambda function
    • Authorize APIs with OAuth 2 Scope
    • Fine-grained Access with AssumeRole
    • Notify Admin users on large file uploads
    • Generate a Month-To-Date Usage report
  • Source Code and Setup
    • Source Code
    • IAM Policies
    • S3 Bucket Policies
    • Suggestions / Feedback
    • More References
  • Deployment
    • AWS SAM
    • Serverless Framework
  • Contributors
    • Team
Powered by GitBook
On this page

Was this helpful?

  1. User Management

Integrate the app with Cognito User Pool

PreviousCreate an App ClientNextCreate the Identity Pool

Last updated 4 years ago

Was this helpful?

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.

Please use a valid email address, as the Cognito will send a verification email to complete the 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