Basic usage of amazon-cognito-identity with modern javascript tooling, react, and the npm ecosystem.
You can use it as a boilerplate for your next kickass AWS-based ES6 serverless react/redux site.
- configure
npm install
to install dependenciesnpm start
to start a development webservernpm run build
to create an optimized static site, ready for deployment, inwebroot/
.
Make a .env
file that looks like this:
AWS_REGION=us-west-2
AWS_IDENTITYPOOL=us-west-2_BADWOLFBADWOLF
AWS_CLIENTAPP=badwolfbadwolfbadwolfbadwo
- Create an app for your user pool. Note that the generate client secret box must be unchecked because the JavaScript SDK doesn't support apps that have a client secret.
- Set the above variables from your AWS console, under Cognito User Pools, replacing the Doctor Who reference with your own stuff.
- Install all the dependencies with
npm install
- Run the app with
npm start
, and click the links. - Once you get your app working the way you want, run
npm run build
and deploy thewebroot/
folder on any static webhost (like S3 or whatever.)