Authentication on the Frontend
Learn how to implement GraphQL implementation with a React frontend.
We’ve spent the last three lessons implementing authentication on our application’s backend. Now, it’s time to update the frontend code.
Fortunately, the frontend implementation will be much simpler. We’ll update the Apollo Client to send cookies with outgoing requests. Then, we’ll implement the login form, which will be very similar to what we’ve already done. Finally, we’ll look into making our authentication flow work well with React.
Sending cookies to the server
Similar to how we enabled Apollo Explorer to include cookies with outgoing requests, we need to enable cookies in the ApolloClient
configuration. To do this, we need to change the configuration of the HTTP connection that ApolloClient
uses. To configure the HTTP connection, we create an instance of HttpLink
and configure ApolloClient
to use it.
Get hands-on with 1400+ tech skills courses.