Giter Club home page Giter Club logo

beenion's Introduction

Blog references

A list of links pointing to a source when a specific blog post is written:

User Interface

Requirements

Deployment

Adjust .env to your AWS_REGION - you can optionally change the application name.

npm install	
sls deploy	

will create a cloudformation stack with lambda functions and other required AWS resources.

sls info -v will show information about the stack including api endpoints.

Creating a Cognito User

The command and queries use a Cognito Api Gateway authorizer for authentication. A cognito user needs to be created in the user pool in order to test the apis.

  • In the AWS console navigate to Cognito -> Manage User Pools -> beenion-dev (default name)

  • Take note of the following

    • "Pool Id" under General Settings <POOL_ID>
    • "App Client ID" under app client <APPCLIENT_ID>

As a cognito user needs to go through a signup and confirmation process typically done from a website - its easiest to create and confirm the cognito user using the awscli with admin credentials.

  • Create and confirm User with temp password
aws cognito-idp admin-create-user \	
 --user-pool-id <POOL_ID> \	
 --username <USER_EMAIL> \	
 --temporary-password 'TempPassword123!' \	
 --message-action SUPPRESS  	
aws cognito-idp admin-initiate-auth \	
--user-pool-id <POOL_ID> \	
--client-id <APPCLIENT_ID> \	
--auth-flow ADMIN_NO_SRP_AUTH \	
--auth-parameters USERNAME='<YOUR_EMAIL>',PASSWORD='TempPassword123!'	

Take note of the long session string in the response

  • Reset the users password
aws cognito-idp admin-respond-to-auth-challenge \	
 --challenge-name 'NEW_PASSWORD_REQUIRED' \	
 --user-pool-id <POOL_ID> \	
 --client-id <APPCLIENT_ID> \	
 --challenge-responses USERNAME='<YOUR_EMAIL>',NEW_PASSWORD='<YOUR_PASSWORD>' \	
 --session '<REPLACE_WITH_SESSION_STRING_FROM_PREVIOUS_COMMAND'   	
  • Get an ID Token
aws cognito-idp admin-initiate-auth \	
 --user-pool-id <POOL_ID> \	
 --client-id <APPCLIENT_ID> \	
 --auth-flow ADMIN_NO_SRP_AUTH \	
 --auth-parameters USERNAME='<YOUR_EMAIL>',PASSWORD='<YOUR_PASSWORD>'	
  • Testing the apis

Use the idtoken above in the Authorization header. Example of posting to the linkCommand handler

curl --request POST \	
  --url https://<YOUR_API_GW_ENDPOINT>/dev/linkCommand \	
  --header 'Authorization: <REPLACE_WITH_ID_TOKEN>' \	
  --header 'Content-Type: application/json' \	
  --data '{"type": "rate",\n "payload": {\n"linkUrl": "https://www.github.com",\n"rating": 10\n}\n}'	

beenion's People

Contributors

domagojk avatar vyper avatar yk-matsu avatar

Watchers

 avatar

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.