Introduction: Interaction with RESTful APIs

An overview of interacting with RESTful APIs.

We'll cover the following

Overview

Having completed our REST API, it's now time to interact with it in our React frontend app. We will start by interacting with the unauthenticated endpoints to get questions by using the browser's fetch function. We will deal with the situation when a user navigates away from a page before data is fetched, preventing state errors.

We will leverage the Auth0 tenant that we set up in the last section to securely sign users in and out of our app. We will then use the access token from Auth0 to access protected endpoints. We will also make sure that authenticated users are only able to see options that they have permission to perform.

By the end of this chapter, our frontend will be interacting fully with the backend, securely and robustly.

Get hands-on with 1200+ tech skills courses.