MCPcopy Index your code
hub / github.com/dbroadhurst/aws-cognito-react

github.com/dbroadhurst/aws-cognito-react @v2.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.0.0 ↗ · + Follow
63 symbols 126 edges 22 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

aws-cognito-react - v2

signin

If you are looking for v1 version it can be found on the legacy branch. With the release of v2, v1 is no longer supported

Reference implementation / boilerplate for AWS Cognito user management

Demo

aws-conginto-react-demo

v2 Changes

  • Switched to Typscript
  • Replaced redux and saga's with react context
  • Upgraded all libraries to latest major versions
  • No security scan issues
  • Hooks used to manage states
  • Updated to Material UI 4x
  • Added AWS CDK to manage infastructure
  • Cleaner and simplier Architecture
  • Responsive design

AWS Cognito Infastructure setup

To help deploy the AWS Congnito infastructre I've create an Amazon Cloud Development (CDK) script

CDK set up instructions can be found here

CDK deploy instructions

cd cdk
cdk deploy

After deployment copy the userPoolId and userPoolClientId values from the command line window; you will need these values in the app config step

App Configuration

Setup the Congnito environment values buy creating app/.env.local file and adding the following

REACT_APP_USERPOOL_ID=YOUR_USER_POOL_ID
REACT_APP_CLIENT_ID=YOUR_CLIENT_ID

Create React App has been used to setup the development process so the next steps should be familar

cd app
npm install
npm start

Other Solutions

Firebase Auth - Great for mobile and web. Fairly limited but easy to use. Integrates really nicely with other Firebase services

Auth0 - Comes with comprehensive and feature rich frontend. Seems to quicky get expensive but a very safe option

Keycloak - Excellent feature rich Enterprise service that offers fully themable frontend. No Cloud solution but easy to deploy to AWS using this CDK script

Useful References

https://www.npmjs.com/package/amazon-cognito-identity-js

https://docs.aws.amazon.com/cdk/api/latest/docs/aws-cognito-readme.html

https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-social-idp.html

https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html

Extension points exported contracts — how you extend this code

IAuth (Interface)
(no doc)
app/src/contexts/authContext.tsx

Core symbols most depended-on inside this repo

useValidPassword
called by 7
app/src/hooks/useAuthHooks.tsx
useValidUsername
called by 5
app/src/hooks/useAuthHooks.tsx
getCognitoUser
called by 4
app/src/libs/cognito.ts
useValidCode
called by 2
app/src/hooks/useAuthHooks.tsx
getSessionInfo
called by 1
app/src/contexts/authContext.tsx
getSession
called by 1
app/src/contexts/authContext.tsx
getAttributes
called by 1
app/src/contexts/authContext.tsx
setAttribute
called by 1
app/src/contexts/authContext.tsx

Shape

Function 58
Class 2
Enum 1
Interface 1
Method 1

Languages

TypeScript100%

Modules by API surface

app/src/contexts/authContext.tsx16 symbols
app/src/libs/cognito.ts12 symbols
app/src/hooks/useAuthHooks.tsx4 symbols
app/src/components/authComponents.tsx4 symbols
cdk/lib/cdk-stack.ts3 symbols
app/src/routes/home.tsx3 symbols
app/src/routes/auth/verify.tsx3 symbols
app/src/routes/auth/signIn.tsx3 symbols
app/src/routes/auth/changePassword.tsx3 symbols
app/src/App.tsx3 symbols
app/src/routes/landing.tsx2 symbols
app/src/routes/auth/signUp.tsx2 symbols

For agents

$ claude mcp add aws-cognito-react \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact