Skip to content

Quick and dirty typescript/javascript example illustrating auth with a cognito user pool, getting an identity pool token, and then exchanging for credentials that can be used to make API calls.

Notifications You must be signed in to change notification settings

lamontadams/cognito-auth-identity-to-credentials-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cognito-auth-identity-to-credentials-example

Quick and dirty typescript/javascript example illustrating auth with a cognito user pool, getting an identity pool token, and then exchanging for credentials that can be used to make API calls. In this case an attempt to read the contents of an S3 bucket.

Prerequisites

  1. Cognito identity and user pools have been created in your aws account
  2. the user pool contains a valid, confirmed user that doesn't need a password reset
  3. the identity pool has been setup to grant your test user read access to the test bucket either via a. an Authenticated User role b. a rule c. a rolename in the cognito session token
  4. the IAM role the identity pool assigns have trust relationships to the identity pool
  5. your test bucket exists, and is not public (or our attempt to read from it will succed regardless)

This example won't run as-is you'll need to define the required objects in your AWS account and change the variable values in index.ts appropriately.

About

Quick and dirty typescript/javascript example illustrating auth with a cognito user pool, getting an identity pool token, and then exchanging for credentials that can be used to make API calls.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published