This project was bootstrapped with Create React App.

Example of authenticating a React application using the Auth0 SPA SDK

Features

There are some important features in this repo:

  • Using the Auth0 SPA SDK to create an React Context (auth0-context.js)
  • Storing auth information in React Context (auth0-context.js)
  • Protecting routes with a  component

Trying out this Repo

To try out this repo and see it in action:

  1. Clone the repo: git clone https://github.com/auth0-blog/react-auth0-spa-sdk-ga
  2. Install dependencies: npm install
  3. Change your credentials in auth0-context.js on line 19, 20
  4. Start the app: npm start
  5. View the app: http://localhost:3000