Using Facebook for authentication

We have seen that many websites provide an option to log in to their website using third-party authentications such as Facebook, Google, Twitter, LinkedIn, and so on. This has been made possible by OAuth, which is an open standard for authorization. It allows the client site to use an access token to access the protected information/resources provided by the resource server. In this recipe, we will see how to implement OAuth-based authorization via Facebook. In the recipes to follow, we will do the same using other providers.

Getting started

First, we will start by installing the Flask-OAuth extension and its dependencies:

$ pip install Flask-OAuth

Next, we have to register for a Facebook application that will be ...

Get Flask Framework Cookbook now with O’Reilly online learning.

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