Chapter 7.  Improving and Adding Authentication to an API with Flask

In this chapter, we will improve the RESTful API that we started in the previous chapter and we will add authentication related security to it. We will:

  • Improve unique constraints in the models
  • Update fields for a resource with the PATCH method
  • Code a generic pagination class
  • Add pagination features to the API
  • Understand the steps to add authentication and permissions
  • Add a user model
  • Create a schema to validate, serialize and deserialize users
  • Add authentication to resources
  • Create resource classes to handle users
  • Run migrations to generate the user table
  • Compose requests with the necessary authentication

Improving unique constraints in the models

When we created the Category model, we ...

Get Building RESTful Python Web Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.