Add Authentication to React with Auth0: Login and User Profile

Create a React Application and Install Dependencies

To create a new application, run the following command:

npx create-react-app auth0-react-qs

Then, install React router and auth0-spa-js:

npm install react-router-dom @auth0/auth0-spa-js

You can read more about auth0-spa-js as well as check out the API docs if you're interested.

You can run the new application by opening a new terminal and running this command:

npm start

This will open a new browser window to localhost:3000. Now that that's done, you can configure your Auth0 application and add a config file to your React app.