Giter VIP home page Giter VIP logo

gatsby-starter-auth-aws-amplify's Introduction

Gatsby Authentication with AWS Amplify

Note: this auth starter was adopted from the original starter by dabit3.

This auth starter implements a basic authentication flow for signing up signing in users as well as protected client side routing using AWS Amplify. Auth features:

  • User sign up
  • User sign in
  • Multi-factor Authentication
  • User sign-out
  • Password Reset
  • Error Feedback

Run locally

  1. Create the project
gatsby new new-auth-site https://github.com/ben-siewert/gatsby-starter-auth-aws-amplify
  1. Change into the new directory
cd new-auth-site
  1. Install dependencies
yarn
# or
npm install
  1. Install & configure the AWS Amplify CLI.
npm install -g @aws-amplify/cli

amplify configure
  1. Create a new AWS Amplify Project
amplify init

Here, walk through the following steps:

  • Enter a name for the project YOURPROJECTNAME
  • Enter a name for the environment master
  • Choose your default editor: Visual Studio Code (or your editor of choice)
  • Choose the type of app that you're building javascript
  • What javascript framework are you using react
  • Source Directory Path: src
  • Distribution Directory Path: public
  • Build Command: npm run build
  • Start Command: npm run dev

The CLI will then initialize a project in the cloud.

  1. Add Auth to the Ampliy project it will configure a CloudFormation template that has an Amazon Cognito resource that enables user authentication.
amplify add auth

Here, walk through the following steps:

  • Default configuration: (recommended)
  • How do you want users to be able to sign in?: recommended: (Email) or (Email and Phone Number)
  • Do you want to configure advanced settings?: recommended: (NO, I am done.) or (Yes, I want to make some additional changes)
  1. Finally, Push the updated project configuration to AWS. It will deploy a CloudFormation template that has an Amazon Cognito resource that enables user authentication.
amplify push
  1. Then you can run it by:
gatsby develop

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.