Giter Site home page Giter Site logo

st-user / cognito-authflow-study Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 155 KB

This repository demonstrates how to implement Developer authenticated identities authflow - Enhanced authflow using Amazon Cognito.

License: MIT License

Go 20.68% HTML 12.57% TypeScript 32.65% HCL 34.10%

cognito-authflow-study's Introduction

cognito-authflow-study

This repository demonstrates how to implement Developer authenticated identities authflow - Enhanced authflow using Amazon Cognito.

  • app
    • 'Developer Provider' (backend application implemented with Golang)
  • client
    • Frontend application running on 'Device'
    • This application accesses a configuration hosted on AWS AppConfig using credentials obtained through the authflow.
  • infra
    • Terraform scripts to build Amazon Cognito and AWS AppConfig resources

NOTE:

The following steps are omitted in the application of this repository for simplicity.

  • 1. Login via Developer Provider (code outside of Amazon Cognito)
  • 2. Validate the user login (code outside of Amazon Cognito)

The application starts the flow from 3. GetOpenIdTokenForDeveloperIdentity.

How to run

Prerequisites

You have to install the followings beforehand.

infra

cd infra
cp secret.tfvars_sample secret.tfvars

Please edit the secret.tfvars like the following:

aws_account_id = "<Input your aws account id>" 
cognito_provider_name = "login.myapp.example.com"
terraform init
terraform plan -var-file="secret.tfvars"
terraform apply -var-file="secret.tfvars"

Terraform should output identity pool ID. We use this when starting 'app'.

NOTE:

We have to deploy the configuration hosted on AWS AppConfig. Please see Step 5: Deploying a configuration for detailed information.

app

cd app

export AWS_IDENTITY_POOL_ID= .... # your identity pool ID Terraform outputs
export AWS_LOGIN_PROVIDER=login.myapp.example.com # == 'cognito_provider_name' in secret.tfvars
export AWS_LOGIN_NAME=test_user
export AWS_TOKEN_DURATION_SECONDS=600
go run .

client

cd client

yarn start

You should see a webpage on localhost:3000 and a start button on it. You can test the authflow by pushing the button!

References

cognito-authflow-study's People

Contributors

st-user 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.