O'Reilly logo

Flask Framework Cookbook by Shalabh Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Authenticating using the Flask-Login extension

In our previous recipe, we learned how to implement session-based authentication ourselves. Flask-Login is a popular extension that handles a lot of stuff for us in a very good way, saving us from reinventing the wheel all over again. It also does not bind us to any specific database or limit us to any specific fields/methods for authentication. It can also handle the Remember me feature, account recovery features, and so on.

Getting ready

We can modify the application created in the previous recipe to accommodate the changes to be done by the Flask-Login extension.

Before that, we have to install the extension itself:

$ pip install Flask-Login

How to do it…

To use Flask-Login, we have to first modify ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required