Giter Club home page Giter Club logo

mobile-notes's People

Contributors

nguyendviet avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

nditech

mobile-notes's Issues

Update role for Cognito

Update cognito roles so it has access to S3. The roles should match the mobile notes app's roles for cognito.

Remove the nested stack

After finishing the API Gateway template, remember to remove the nested stack used to pass parameters to the API Gateway template.

Cloudformation: Error: Member must have length less than or equal to 20

CloudFormation to create Cognito User Pool:

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "Template creates AWS Cognito UserPool.",
    "Resources": {
        "CognitoUserPool": {
            "Type": "AWS::Cognito::UserPool",
            "Properties": {
                "Policies": {
                    "PasswordPolicy": {
                        "MinimumLength": 8,
                        "RequireUppercase": true,
                        "RequireLowercase": true,
                        "RequireNumbers": true,
                        "RequireSymbols": true
                    }
                },
                "Schema": [
                    {
                        "Name": "sub",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": false,
                        "Required": true,
                        "StringAttributeConstraints": {
                            "MinLength": "1",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "name",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "given_name",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "family_name",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "middle_name",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "nickname",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "preferred_username",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "profile",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "picture",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "website",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "email",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": true,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "email_verified",
                        "AttributeDataType": "Boolean",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false
                    },
                    {
                        "Name": "gender",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "birthdate",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "10",
                            "MaxLength": "10"
                        }
                    },
                    {
                        "Name": "zoneinfo",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "locale",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "phone_number",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "phone_number_verified",
                        "AttributeDataType": "Boolean",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false
                    },
                    {
                        "Name": "address",
                        "AttributeDataType": "String",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "StringAttributeConstraints": {
                            "MinLength": "0",
                            "MaxLength": "2048"
                        }
                    },
                    {
                        "Name": "updated_at",
                        "AttributeDataType": "Number",
                        "DeveloperOnlyAttribute": false,
                        "Mutable": true,
                        "Required": false,
                        "NumberAttributeConstraints": {
                            "MinValue": "0"
                        }
                    }
                ],
                "LambdaConfig": {},
                "AutoVerifiedAttributes": [
                    "email"
                ],
                "UsernameAttributes": [
                    "email"
                ],
                "SmsVerificationMessage": "Your verification code is {####}. ",
                "EmailVerificationMessage": "Your app verification code is {####}. ",
                "EmailVerificationSubject": "Your app verification code",
                "SmsAuthenticationMessage": "Your authentication code is {####}. ",
                "MfaConfiguration": "OFF",
                "EmailConfiguration": {},
                "UserPoolTags": {},
                "AdminCreateUserConfig": {
                    "AllowAdminCreateUserOnly": false,
                    "UnusedAccountValidityDays": 7,
                    "InviteMessageTemplate": {
                        "SMSMessage": "Your username is {username} and temporary password is {####}. ",
                        "EmailMessage": "Your username is {username} and temporary password is {####}. ",
                        "EmailSubject": "Your temporary password"
                    }
                }         
            }
        }          
    },
    "Outputs": {
        "CognitoUserPoolARN": {
            "Value": {
                "Fn::GetAtt": [
                    "CognitoUserPool",
                    "Arn"
                ]
            },
            "Export": {
                "Name": {
                    "Fn::Sub": "${AWS::StackName}-cognito-userpool-arn"
                }
            }
        }
    }
}

Error:

1 validation error detected: Value 'phone_number_verified' at 'schema.18.member.name' failed to satisfy constraint: Member must have length less than or equal to 20 (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: REQUEST_ID)

GET /notes error

Access to XMLHttpRequest at 'https://<URL>/prod/notes' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response.

Not CORS issue.

Add Lambda code

To created stack: 2019-06-11 11:27:56 UTC-0400 | test-nested-stack-11jun.

Add frontend code to created S3

Add the frontend code to a provisoned S3 bucket to make API calls with token from the provisioned Cognito Pool. Can also retrieve the token to test with PostMan.

Create API Gateway template

Template should:

  • Take outputs from database stack (dynamodb stack).
  • Provision Lambda and API Gateway with deployment (prod).
  • Hook with the right DynamoDB table.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.