Skip to content

Latest commit

 

History

History
88 lines (62 loc) · 1.84 KB

README.md

File metadata and controls

88 lines (62 loc) · 1.84 KB

Login and Profile

Tech Used

AWS CDK - DynamoDB, HttpAPI, Lambda, Cognito / TypeScript

How to build

Useful Cognito Commands

See ./cdk-outputs.json

Create a Cognito User

aws cognito-idp admin-create-user \
  --user-pool-id YOUR_USER_POOL_ID \
  --username [email protected] \
  --user-attributes Name="locale",Value="pt-BR"

Add Password

aws cognito-idp admin-set-user-password \
  --user-pool-id YOUR_USER_POOL_ID \
  --username [email protected] \
  --password SET_NEW_PASSWORD \
  --permanent

Verify Email

aws cognito-idp admin-update-user-attributes \
  --user-pool-id YOUR_USER_POOL_ID \
  --username [email protected] \
  --user-attributes Name="email_verified",Value="true"

Login

aws cognito-idp initiate-auth \
  --auth-flow USER_PASSWORD_AUTH \
  --auth-parameters \
  USERNAME="[email protected]",PASSWORD="password123" \
  --client-id YOUR_USER_POOL_CLIENT_ID

The result will be:

{
  "ChallengeParameters": {},
  "AuthenticationResult": {
    "AccessToken": "ACCESS_TOKEN",
    "ExpiresIn": 3600,
    "TokenType": "Bearer",
    "RefreshToken": "REFRESH_TOKEN",
    "IdToken": "ID_TOKEN"
  }
}

The IdToken will be used to test the API.

Using PostMan need to set in Authorization tab type Bearer Token and put the IdToken.


Seed plans

  • run aws dynamodb batch-write-item --request-items file://data/plans.json

Seed referral

  • run aws dynamodb batch-write-item --request-items file://data/referral.json