Chapter 6. Securing Your App

We have a mostly functioning blog app, but it is missing some crucial features, such as user login, registration, and adding and editing posts from the browser. The user login functionality can be created in many different ways, so each of the sections demonstrates mutually exclusive methods to create logins. The first way is directly using the browser's cookies, and the second way is using a Flask extension named Flask Login.

Setting up

Before we jump right into making a user authentication system, there is a lot of setup code. To run any type of authentication, our app will need the following elements common to all:

  • First, the user models will need proper password hashing
  • Second, a login form and a registration form ...

Get Mastering Flask 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.