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 Flask: Building Python Web Services now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.