Git Product home page Git Product logo

aws-samples / aws-nft-gallery-web3-cognito Goto Github PK

View Code? Open in Web Editor NEW
13.0 6.0 6.0 3.78 MB

dApp authentication with Amazon Cognito and Web3 proxy with Amazon API Gateway

Home Page: https://aws.amazon.com/blogs/architecture/dapp-authentication-with-amazon-cognito-and-web3-proxy-with-amazon-api-gateway/

License: MIT No Attribution

JavaScript 99.42% CSS 0.58%
authentication authorization aws web3 alchemy api-gateway cognito moralis

aws-nft-gallery-web3-cognito's Introduction

NFT Gallery

This decentralized web application (dApp) permits users to display their own NFTs or any NFT collections on Ethereum. Any users can look up any NFT collections while Authenticated users can also look up their own NFTs.

Read this related AWS Blog post for more information: https://aws.amazon.com/blogs/architecture/dapp-authentication-with-amazon-cognito-and-web3-proxy-with-amazon-api-gateway/

Preview

Overview

This project demonstrates how you can use various AWS services to authenticate users with their digital wallet and make secure API calls to third party Web3 API providers like Alchemy and Moralis.

You will learn how you can use Amazon Cognito to authenticate users using their digital wallet to obtain an identity and temporary AWS credentials to grant your front web application access to the AWS services you need.

You will use an Amazon Cognito custom authentication challenge to ask users to sign a random message with their digital wallet. Amazon Cognito, by the way of Lambda Triggers, will validate if the signature is valid and will issue an ID token which proves that the user's wallet address has signed the given message with his digital wallet.

You will also experiment with multiple ways to authorize access to Amazon API Gateway routes using Cognito Authorizers and IAM Roles. You will also explore how to use Amazon Cognito IdentityPool to grant IAM Roles to authenticated and unauthenticated users thus securing your API to all users including anonymous users.

Finally, you will learn how to use API Gateway as proxy to third party Web3 APIs. In this case you will proxy calls to two Web3 providers, Alchemy and Moralis.

Architecture

Architecture

Deployment

  1. Go to the backend folder, open the README there and deploy the architecture to AWS using SAM.
  2. Go to the dapp folder, open the README, run the dApp locally, and deploy it to AWS using the AWS CLI.

Inspiration

This work was inspired by: https://davbarrick.medium.com/how-to-build-a-serverless-web3-wallet-login-like-opensea-with-metamask-and-cognito-eb93c723f4de

Thanks

@the-rpc for the code review and ReactJS expertise

aws-nft-gallery-web3-cognito's People

Contributors

amazon-auto avatar jplock avatar keithrozario avatar koxon avatar the-rpc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

aws-nft-gallery-web3-cognito's Issues

Changing wallet address not reflected in UI

If I change my wallet address, the UI doesn't reflect the changes and the user is still logged in with his previous wallet address.

Wanted behavior:

  • Detect wallet address change
  • Disconnect user if wallet address changed

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.