Example server for amazon-cognito-identity-dart.
-
Clone repository.
git clone [email protected]:jonsaw/example-secure-counter-server.git
-
Setup DynamoDB Table.
Properties: TableName: counter-dev AttributeDefinitions: - AttributeName: userId AttributeType: S KeySchema: - AttributeName: userId KeyType: HASH ProvisionedThroughput: ReadCapacityUnits: 1 WriteCapacityUnits: 1
-
Get dependencies and build.
make
-
Install serverless.
npm install serverless -g
-
Deploy & take note of API Endpoint Id.
serverless deploy
-
Setup AWS Cognito.
-
Give AWS IAM Role access to Lambda function. Replace xxxxxxxxxx with Endpoint Id.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "mobileanalytics:PutEvents", "cognito-sync:*", "cognito-identity:*" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "execute-api:Invoke" ], "Resource": [ "arn:aws:execute-api:ap-southeast-1:*:xxxxxxxxxx/*" ] } ] }