Chapter 4: Building API Authentication
This chapter is dedicated to the best practices and recommendations to follow while building a public REpresentational State Transfer (REST) application programming interface (API). It explores how to write an authentication middleware to secure the access to the API endpoints and how to serve them through HyperText Transfer Protocol Secure (HTTPS).
In this chapter, we will focus on the following main topics:
- Exploring authentication
- Introducing JavaScript Object Notation (JSON) Web Tokens (JWTs)
- Persisting client sessions and cookies
- Authenticating with Auth0
- Building an HTTPS server
By the end of this chapter, you will be able to build a RESTful API with both private and public endpoints.